I'm trying to use 'type'=> 'datetime-local' in my form to create the date time picker. In the view everything works fine but cakephp can't handle the format of the result. I've tried to cast it to a Cake\I18n\Time but it ignores the set time and is using the current time.
Did anyone use the html5 date time picker in cakephp? Is there any intention to make it the default picker in cake?
The cakephp default picking option with a lot of select boxes is not really handy.
CakePHP doesn't support the format used by the HTML5 datetime-local input (
YYYY-MM-DDTHH:MM) out of the box (yet).You can solve this by for example using a custom/extended database type that adds a proper format to the existing default formats (this will affect all datetime fields/columns), like:
by parsing the input manually before marshalling:
or by enabling localized parsing, and supplying a matching format (this will restrict all datetime fields/columns to this one format):
See also