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

François Suter fsu-lists at cobweb.ch
Tue May 24 10:18:03 CEST 2011


Hi,

> 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.

IMO the problem comes from the PHP DateTime object which initiliazes to 
the current date and time when it receives NULL as input.

> 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.

I agree. In my case it was okay to ignore 0 because I didn't expect such 
old dates, but that's of course not universal.

Cheers

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-project-typo3v4mvc mailing list