Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

FrozenDate::parseDate doesn't work with September

Is there a reason why FrozenDate::parseDate, called with the month of September (ex. Sep), the date doesn’t get parsed?

Code:

$months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];

foreach($months as $m)
{
    $d = "01-".$m."-23";
    debug($d);
    $fd = FrozenDate::parseDate($d, "dd-MMM-yy");
    debug($fd);
}


APP/Controller\AdministratorsController.php (line 202)
'01-Sep-23'
APP/Controller\AdministratorsController.php (line 204)
null

Edit #1

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Tried outputting any errors using getLastErrors(). Nothing there either.

debug(FrozenDate::getLastErrors());

APP/Controller\AdministratorsController.php (line 205)
[
'warning_count' => (int) 0,
'warnings' => [ ],
'error_count' => (int) 0,
'errors' => [ ],
]

Edit #2

Seems using "Sept" works. Noting that I’m importing from Excel and the format given is "Sep" and not "Sept". And, the date "01-Sept-23" converts to "01-Sep-2023" in Excel for some reason.

$months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];

foreach($months as $m)
{
    $d = "01-".$m."-23";
    debug($d);
    $fd = FrozenDate::parseDate($d, "dd-MMM-yy");
    debug($fd);
}

>Solution :

CLDR/ICU problem, in newer versions (not sure about the latest, can’t test it right now), for certain locales either Sept was introduced, or Sep was removed, or vice versa, or some combination or whatever. It’s not clear to me from any of the comments, and I really don’t feel like wasting hours to investigate it.

tl;dr, classic CLDR/ICU L. Better get used to it, stuff like this happens regularly.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading