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

Report information
The Basics
Id:
82342
Status:
resolved
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
steve [...] deefs.net
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Errors in boundary cases
DateTime::BusinessHours doesn't seem to handle weekend transitions properly. Currently, all six of the following tests fail (they're ignoring the fact that the start or end date is a weekend): use Test::More tests => 6; use strict; use warnings; use DateTime::BusinessHours; use DateTime; # 2012-12-01 is a Saturday my $d1 = DateTime->new( year => 2012, month => 12, day => 1, hour => 12 ); my $d2 = DateTime->new( year => 2012, month => 12, day => 1, hour => 15 ); my $t = DateTime::BusinessHours->new( datetime1 => $d1, datetime2 => $d2, ); is( $t->getdays, 0, 'Start and end on a weekend (getdays)' ); is( $t->gethours, 0, 'Start and end on a weekend (gethours)' ); $d1 = DateTime->new( year => 2012, month => 11, day => 30, hour => 15 ); $d2 = DateTime->new( year => 2012, month => 12, day => 1, hour => 15 ); $t->calculate(); is( $t->getdays, 2 / 8, 'Start on Friday 3pm, end on a weekend (getdays)' ); is( $t->gethours, 2, 'Start on Friday 3pm, end on a weekend (gethours)' ); $d1 = DateTime->new( year => 2012, month => 12, day => 2, hour => 15 ); $d2 = DateTime->new( year => 2012, month => 12, day => 3, hour => 15 ); $t->calculate(); is( $t->getdays, 6 / 8, 'Start on Sunday 3pm, end on Monday 3pm (getdays)' ); is( $t->gethours, 6, 'Start on Sunday 3pm, end on Monday 3pm (gethours)' );


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.