centurion-project / Centurion

Centurion is an open-source CMS delivered as a flexible PHP5 Content Management Framework
http://www.centurion-project.org
197 stars 51 forks source link

Problem in Centurion_Locale_Format #15

Closed aurmil closed 12 years ago

aurmil commented 12 years ago

bug example with Centurion_Locale_Format::convertDatepickerToIsoFormat(), dd/MM/yy becomes dd/MMMMMMMMMMMMMMM/yyyyyyyy instead of dd/MMMM/yyyy

bug explanation after arsort, Centurion_Locale_Format::$formatIsoToDatepicker looks like this: array 'yy' => string 'yyyy' (length=4) 'y' => string 'yy' (length=2) 'dd' => string 'dd' (length=2) 'd' => string 'd' (length=1) '@' => string 'U' (length=1) 'MM' => string 'MMMMM' (length=5) 'M' => string 'MMM' (length=3) 'mm' => string 'MM' (length=2) 'm' => string 'M' (length=1) 'DD' => string 'EEEE' (length=4) 'D' => string 'EEE' (length=3) 'oo' => string 'DD' (length=2) 'o' => string 'D' (length=1)

so "yy" are replaced by "yyyy" and then "y" are replaced by "yy", by str_replace, same problem for "M"

these lines should be removed as they are useless: 'yy' => string 'yyyy' (length=4) 'dd' => string 'dd' (length=2) 'd' => string 'd' (length=1)

I do not have solution right now for "M" or you might not use str_replace

lchenay commented 12 years ago

Thanks for this issue. I will write a test unit and the fix right now.