[TYPO3-mvc] DateTiime Fields / configuring the new property manager

Matthias Krappitz matthias at nospam.aemka.de
Thu Oct 27 18:15:58 CEST 2011


> i've digged a bit into your issue and stumpled about the DateTimeConverter 
> [1] included in the new PropertyMapper. The class comment shows a way to 
> change the expected format:
>
>  * The date string is expected to be formatted according to 
> DEFAULT_DATE_FORMAT
>  * But the default date format can be overridden in the 
> initialize*Action() method like this:
>  * $this->arguments['<argumentName>']
>  *   ->getPropertyMappingConfiguration()
>  *   ->forProperty('<propertyName>') // this line can be skipped in order 
> to specify the format for all properties
>  * ->setTypeConverterOption('Tx_Extbase_Property_TypeConverter_DateTimeConverter', 
> Tx_Extbase_Property_TypeConverter_DateTimeConverter::CONFIGURATION_DATE_FORMAT, 
> '<dateFormat>');

Thank you very much for the digging! That is the solution for having the 
datetimes parsed correctly when entered in the right format in the frontend!

But still - what can I do, if a frontend user by mistakes does not enter the 
date in the right format 'd.m.Y'? In 
extbase/Classes/Property/TypeConverter/DateTimeConverter.php on line 125 
there is an Exception being thrown in that case, which results in a TYPO3 
error page for the user. I don't see a way yet to prevent this from 
happening. Maybe I'm still not getting the overall concept, but I the 
desired behaviour should probably be to get a form error  in the frontend 
(it was like that with the old property manager)and not a fatal error like 
that.

Any ideas?

Matthias 



More information about the TYPO3-project-typo3v4mvc mailing list