[TYPO3-mvc] Validation of non-mandatory DateTime fields
Martin Kutschker
masi-no at spam-typo3.org
Tue May 24 10:42:08 CEST 2011
Am 24.05.2011 10:36, schrieb Martin Kutschker:
> Am 24.05.2011 10:18, schrieb François Suter:
>>
>> IMO the problem comes from the PHP DateTime object which initiliazes to the current date and time
>> when it receives NULL as input.
>
> This is a bit harder to change than usual ;)
How about using the NULL object pattern? When no date is given (ie the DB value is NULL) you create
an object that has the full API of DateTime (and is a child class), but return an empty string or
whatever is appropriate for "no date".
Masi
More information about the TYPO3-project-typo3v4mvc
mailing list