Yii Framework Forum: Unexpected behavior in DateParser - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Unexpected behavior in DateParser Logging here as Yii 1.1 ie EOL, but might affect Yii2 Rate Topic: -----

#1 User is offline   le_top 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 460
  • Joined: 08-June 10
  • Location:France (Ile-de-France/Val d'Oise)

Posted 03 July 2017 - 04:48 PM

Months with dots not parsed correctly.
Might affect Yii2, but detected in Yii, so not logging under Yii2.

French date (medium) "3 juil. 2017" not decoded correctly using CDateTimeParse.

### What steps will reproduce the problem?

$langs=['fr_FR','en_US','de','nl','br','pt'];
foreach($langs as $lang) {
Yii::app()->setLanguage($lang);
$locale=Yii::app()->getLocale();
$dateFormat=$locale->getDateFormat('medium');
$orgtime=1499116891;
$datestr=$locale->dateFormatter->format( $dateFormat, $orgtime );
$finaltime=CDateTimeParser::parse($datestr,$dateFormat);
if($finaltime===false) {
$finaltime="**** PARSE ERROR ****";
}
print "$lang: time($orgtime)->'$datestr'->$finaltime<br/>\n";
}

### What is the expected result?

No parse errors.

### What do you get instead?

Parse errors. Abbreviated months with '.' not parsed correctly.

### Additional info

| Q | A
| ---------------- | ---
| Yii version | 1.1.17
| PHP version | 7.?
| PHP version | 5.6
| Operating system | Windows/Debian




(Currently debugging, seems related to stripping of point from month and then not skipping it in the datetimeparser. A bit more complex than expected to fix this properly.)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users