Subject: | Error in DateCalc when using business days and extra time ("+2 business days 2 minutes") |
Date: | Wed, 21 Apr 2010 11:11:57 +1000 |
To: | bug-Date-Manip [...] rt.cpan.org |
From: | Damien Moore <damien.moore [...] its.monash.edu.au> |
Hullo,
Hoping I'm not reporting something fixed in a newer version of
Date::Manip - apologies if I am, I cannot upgrade to test this.
perl -v
This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi
(with 40 registered patches, see perl -V for more detail)
DateManipVersion()
6.07
uname -a
Linux hostname 2.6.32.2 #2 SMP Sun Jan 31 13:01:55 EST 2010 i686 GNU/Linux
The problem occurs when you use a date calculation such as "+2
business days 2 minutes" - the minute part is added twice.
print UnixDate("now","%Y-%m-%d %T"). "\n";
print UnixDate(DateCalc("now","+2 days",\$err),"%Y-%m-%d %T")."\n";
print UnixDate(DateCalc("now","+2 days 2 minutes",\$err),"%Y-%m-%d %T")."\n";
print UnixDate(DateCalc("now","+2 business days",\$err),"%Y-%m-%d %T")."\n";
print UnixDate(DateCalc("now","+2 business days 2
minutes",\$err),"%Y-%m-%d %T")."\n";
returns
2010-04-21 11:04:22
2010-04-23 11:04:22
2010-04-23 11:06:22
2010-04-23 11:04:22
2010-04-23 11:08:20
In the last case, the date is 2 business days + 4 minutes.
FWIW, I also tested it on an older version of the module on Solaris
and it works correctly:
perl -v
This is perl, v5.8.3 built for sun4-solaris
DateManipVersion()
5.54
uname -a
SunOS fulcrum 5.9 Generic_122300-19 sun4u sparc SUNW,Sun-Fire-V490 Solaris
thanks in advance,
Damien Moore
---------
CMS Developer,
ITS WebCentre