Closed ralacroix closed 2 years ago
It works fine for me:
############################
use Date::Manip::Date; $d = new Date::Manip::Date;
$d->parse('1916apr22'); print $i = $d->value(),"\n";
$d->parse('1916apr23'); print $i = $d->value(),"\n";
$d->parse('1916apr24'); print $i = $d->value(),"\n"; ##########################
produces:
1916042200:00:00 1916042300:00:00 1916042400:00:00
Can you give me a script where it fails?
I get your result if I change the system timezone, for example with timedatectl set-timezone America/Toronto With the system timezone set to America/Winnipeg, your code produces the following output:
1916042200:00:00
1916042400:00:00
The value for 1916apr23 is a zero-length string. The call to parse() returns an error code of 1 for that date, and 0 for the dates that worked.
If you do the following:
##################
use Date::Manip::Date; $d = new Date::Manip::Date; $d->config('setdate','now,America/Winnipeg');
$d->parse('1916apr23'); print $i = $d->value(),"\n"; print $d->err(); ####################
you get:
[parse] Invalid date in timezone
and sure enough, on 1916-04-22 23:59:59 the time jumped forward (that is the date that daylight saving time was introduced there), so there was no date 1916-04-23 00:00:00 (which is the date you are parsing).
So, perfectly correct (though unexpected) behavior.
However "1916apr22" and "1916apr24" parse correctly. What is so special about "1916apr23"?
This problem affects every version of Date:Manip that I checked, on 5 distinct systems.
Date::Manip 6.76 (Debian 10, perl v5.28.1) Date::Manip 6.60 (Red Hat Enterprise Linux 8.5, perl v5.26.3; and also CentOS Linux 8, perl v5.26.3) Date::Manip 6.41 (CentOS Linux 7, perl v5.16.3) Date::Manip 6.24 (Red Hat Enterprise Linux 6.10, perl v5.10.1).