Jose,

It turns out that I AM MISTAKEN...  The input field I was looking at was 
defined as a "datetime".

However...  The real issue is that the datetime input field is populated by 
cake always as yyyy-mm-dd hh:mm:ss  If it is a date object, it is 
yyy-mm-dd.  If I am in locale en-US and have added the following to the 
boostrap.php
DispatcherFactory::add('LocaleSelector', ['locales' => ['en_US']]);

Type::build('datetime')->useLocaleParser();
Type::build('date')->useLocaleParser()->setLocaleFormat(['MM/dd/yyyy', \
IntlDateFormatter::NONE]);
Type::build('time')->useLocaleParser()->setLocaleFormat([\IntlDateFormatter
::NONE, 'hh:mm a']);

Then, the parser on any attempt to save the data will die... returns 
null... and then attempts to use null as a pointer.

If I change the parser to they mysql yyy-mm-dd or remove the parser 
altogether, then it works.  All of this is just to keep from using 3 fields 
to enter a date, or 6 fields to enter a datetime!  I want to use a js 
datepicker and have LOCALE style inputs.

In DateTimeType.php the "marshal" function uses sprintf() to format the 
date/time and probably should be using  a "time->i18nFormat()" to get the 
default user time shown and then the parser should use new Time( 
$input_str, USER_TIMEZONE) to parse the string... it accepts multiple types 
of input strings and "figures" out the order of MDY.  Then it should store 
the time in the yyy-mm-dd hh:mm:ss converted to SERVER_TIMEZONE.

The use of setLocaleFormat just complicates everything... If the 
i18n->locale is set, Time:: takes care of parsing the string!

Sorry for all the blather, I'm just trying to explain what I think it 
should be doing.  Again, I'm sorry for mistakenly stating that the time is 
always output for a "date" field.  By the way, "time" fields are also fixed 
format in the marshaller!



On Monday, October 26, 2015 at 4:36:21 AM UTC-6, José Lorenzo wrote:
>
> It is an unimplemented feature... Someone need to solve that issue of 
> showing time in a date column
>
> On Friday, October 23, 2015 at 9:56:34 PM UTC+2, glk wrote:
>>
>> @JoseLorenzo
>>
>> The reason is that the cake $this->Form->input('date_field') always 
>> generates 3 input fields.  If the input uses type=text, the field is 
>> populated with mm/dd/yyyy, hh:mm:ss
>> And all we should have is mm/dd/yyyy... of course it should also be 
>> LOCALE format.
>>
>>
>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to