[TYPO3-mvc] Validation of non-mandatory DateTime fields

Martin Kutschker masi-no at spam-typo3.org
Tue May 24 09:47:32 CEST 2011


Am 17.05.2011 14:35, schrieb François Suter:
> 
> Indeed when an instance model object containing a DateTime property is created, that DateTime object
> will contain the current date and time if the underlying value (i.e. the database value) is 0 or
> NULL. This makes it impossible to have an empty date field when using the DateTime object.

But why does it have a default of today? I might want to initialize the current date in the
controller, but I might want not to. Where is the default set? In the persistence layer? I hope not
- or somewhere in the controller/view logic? In the persistence layer it is wrong (and IMHO in the
view), in the controller it should be configurable.

Also I don't think that 0 should be treated as "no value set". That's why we have NULL. 0 is simply
the start of the Unix epoch and a valid date.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list