Ok, the docs do say that the $format variable can be either an array of two
integers or a single string value specifying a pattern. I see no reason
that the array could not be two patterns, but will just cover my calls to
i18nFormat with another function to make the corrections.
The _formatObject does exactly what the docs say! Maybe the docs could
emphasize it a littler more, and the function should probably throw a more
informative InvalidArgumentException?
On Tuesday, January 5, 2016 at 5:29:30 PM UTC-7, glk wrote:
>
> I've modified the Time::_formatObject function allow some debug info
> (beginning at line 617) as follows:
>
>
> debug($date);
>> debug($format);
>> debug($locale);
>> debug($dateFormat);
>> debug($timeFormat);
>> debug($timezone);
>> debug($calendar);
>> debug($pattern);
>>
>> static::$_formatters[$key] = datefmt_create(
>> $locale,
>> $dateFormat,
>> $timeFormat,
>> $timezone,
>> $calendar,
>> $pattern
>> );
>> }
>> debug($_formatters[$key]);
>> die();
>> return static::$_formatters[$key]->format($date);
>>
>>
> The output:
>
> *\src\I18n\Time.php* (line *617*)
>>
>> object(Cake\I18n\Time) {
>>
>> 'time' => '2016-01-05T17:25:10-0700',
>> 'timezone' => 'America/Denver',
>> 'fixedNowTime' => false
>>
>> }
>>
>> *\src\I18n\Time.php* (line *618*)
>>
>> [
>> (int) 0 => 'yyyyMMdd',
>> (int) 1 => (int) -1
>> ]
>>
>> *\src\I18n\Time.php* (line *619*)
>>
>> 'en_US'
>>
>> *\src\I18n\Time.php* (line *620*)
>>
>> 'yyyyMMdd'
>>
>> *\src\I18n\Time.php* (line *621*)
>>
>> (int) -1
>>
>> *\src\I18n\Time.php* (line *622*)
>>
>> 'America/Denver'
>>
>> *\src\I18n\Time.php* (line *623*)
>>
>> (int) 1
>>
>> *\src\I18n\Time.php* (line *624*)
>>
>> null
>>
>> *Warning* (2): datefmt_create() expects parameter 2 to be long, string given
>> [*CORE\src\I18n\Time.php*, line *633*]
>>
>> *Notice* (8): Undefined variable: _formatters [*CORE\src\I18n\Time.php*,
>> line *635*]
>>
>> *\src\I18n\Time.php* (line *635*)
>>
>> null
>>
>>
>
> I really don't understand why the format() routine wants a long value...
> It could be a string with hh:ss etc...
> However, I happend to use \IntlDateFormatter::NONE for the timeFormat.
>
> The error manifests due the return statement trying to execute ->format on
> a null pointer.
>
>
>
--
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.