Skip Menu |
 

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

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

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

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



Subject: Errors in boundary cases
Download (untitled) / with headers
text/plain 1.2k
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)' );
Download (untitled) / with headers
text/plain 108b
This should now be fixed in version 2.03. https://metacpan.org/release/BRICAS/DateTime-BusinessHours-2.03


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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