CC: | Pablo Rodríguez <pablo.rodriguez [...] meteologica.com> |
Subject: | Weird behaviour with kk format for hours |
Date: | Tue, 29 Oct 2013 16:41:04 +0100 |
To: | bug-DateTime-Format-CLDR [...] rt.cpan.org |
From: | Gonzalo Mateo <gonzalo.mateo [...] meteologica.com> |
Hello,
We have detected an issue while parsing dates with kk option for hours. We
don't know if it is the expected behaviour but if so it should be
menctioned in the documentation.
We were expecting kk option to substract one to the hour and then setting
it while the behaviour is setting the hour as it comes unless it is 24 set
it to 0.
It happens that with date "2013/07/21 24:00" it returns date:
2013-07-21T00:00:00
while the natural behaviour (we understand) should be returning
2013-07-21T23:00:00. In the case the date is "2013/07/21 01:00" we think
the formated date should be: 2013-07-21T00:00:00
print $]."\n";
my $cldr = new DateTime::Format::CLDR(
pattern => 'yyyy/MM/dd kk:mm',
time_zone => 'Europe/Madrid',
);
print "Formatter: DateTime::Format::CLDR
".$cldr->parse_datetime("2013/07/21 24:00")."\n";
print "Formatter: DateTime::Format::CLDR
".$cldr->parse_datetime("2013/07/21 01:00")."\n";
print "Formatter: DateTime::Format::CLDR
".$cldr->parse_datetime("2013/07/21 02:00")."\n";
print "Formatter: DateTime::Format::CLDR
".$cldr->parse_datetime("2013/07/21 03:00")."\n";
Output:
5.016002
Formatter: DateTime::Format::CLDR 2013-07-21T00:00:00
Formatter: DateTime::Format::CLDR 2013-07-21T01:00:00
Formatter: DateTime::Format::CLDR 2013-07-21T02:00:00
Formatter: DateTime::Format::CLDR 2013-07-21T03:00:00
Thank you in advance for your help
Yours faithfully
*_____________________________________________________________________________________*
*
*
*Gonzalo Mateo García* - mailto: gonzalo.mateo@meteologica.com
*__________________________________________________________________________________________________________*
Message body is not shown because sender requested not to inline it.