Subject: | Incorrect business date calculations |
Date: | Wed, 12 Mar 2014 13:23:40 -0700 |
To: | bug-Date-Manip [...] rt.cpan.org |
From: | John <perl [...] 8192.net> |
Some business date calculations are performed incorrectly. The following
code should produce the same date twice, but instead produces two
different dates:
use Date::Manip;
my $d1 = Date::Manip::Date->new( "epoch 1394651587" );
my $d2 = Date::Manip::Delta->new("54000 business seconds");
$d2->config('WorkWeekBeg', 1);
$d2->config('WorkWeekEnd', 5);
$d2->config('WorkDayBeg', "02:00");
$d2->config('WorkDayEnd', "17:00");
warn $d1->calc($d2)->printf('%c');
$d1 = Date::Manip::Date->new( "epoch 1394651587" );
$d2 = new Date::Manip::Delta();
$d2->config('WorkWeekBeg', 1);
$d2->config('WorkWeekEnd', 5);
$d2->config('WorkDayBeg', "02:00");
$d2->config('WorkDayEnd', "17:00");
$d2->set('business', [0,0,0,0,0,0,54000]);
warn $d1->calc($d2)->printf('%c');
As far as I can tell the problem occurs when Date::Manip::Delta
normalizes the delta.