Skip Menu |

This queue is for tickets about the DateTime-BusinessHours CPAN distribution.

Report information
The Basics
Id: 34041
Status: resolved
Priority: 0/
Queue: DateTime-BusinessHours

People
Owner: Nobody in particular
Requestors: k [...] xmltok.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Calculates bad numbers
Date: Wed, 12 Mar 2008 21:58:46 -0700
To: bug-DateTime-BusinessHours [...] rt.cpan.org
From: Kraig <k [...] xmltok.com>
Looks like there is a few other problems with this as well #!/usr/bin/perl use DateTime::BusinessHours; use DateTime; my $datetime1=DateTime->new(year=>2007,month=>10,day=>15, hour=>12); my $datetime2=DateTime->new(year=>2007,month=>10,day=>15, hour=>15); my $testing = DateTime::BusinessHours->new(datetime1=>$datetime1, datetime2=>$datetime2, worktiming=>[9,18], # 9 am to 6 om weekends=>[6,7], #saturday , sunday ); print $testing->getdays."\n"; # the total business days print $testing->gethours."\n"; # the total business hours Results in: 0 -6
On Thu Mar 13 00:59:40 2008, k@xmltok.com wrote: Show quoted text
> Looks like there is a few other problems with this as well > > #!/usr/bin/perl > use DateTime::BusinessHours; > use DateTime; > > my $datetime1=DateTime->new(year=>2007,month=>10,day=>15, hour=>12); > my $datetime2=DateTime->new(year=>2007,month=>10,day=>15, hour=>15); > > my $testing = DateTime::BusinessHours->new(datetime1=>$datetime1, > datetime2=>$datetime2, > worktiming=>[9,18], # 9 am to 6 om > weekends=>[6,7], #saturday , sunday > ); > > print $testing->getdays."\n"; # the total business days > print $testing->gethours."\n"; # the total business hours > > > Results in: > 0 > -6
Thanks for sharing this example. Could you provide in a Test::More style test case so it's clear what the expected result was? I realize this has been ages ago, and you may have likely moved on.
Should be fixed in 2.00, released to CPAN.