Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: steven.lynch [...] network-box.com.au
Cc:
AdminCc:

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



Subject: Unintended side-effect of end day comparison
Date: Fri, 30 Nov 2012 08:54:48 +1100
To: bug-DateTime-BusinessHours [...] rt.cpan.org
From: Steven Lynch <steven.lynch [...] network-box.com.au>
Download (untitled) / with headers
text/plain 902b
Hi, There appears to be a bug in DateTime::BusinessHours version 2.01 where the end date is truncated as a side-effect of a conditional test. In the part of the code that tests for the start and end being on different days (line 92). The line is currently: # if start and end aren't on the same day if( $d1->truncate( to => 'day' ) != $d2->truncate( to => 'day' ) ) { which will truncate $d2 and, unlike $d1, $d2 is used subsequently. I have tested after avoiding the side-effect, as shown: if( $d1->truncate( to => 'day' ) != $d2->clone->truncate( to => 'day' ) ) { and everything seems to work fine. Regards Steven -- Steven Lynch [Chief Engineer] mailto: steven.lynch@network-box.com.au Network Box Australia Pty Ltd Phone: +61-3-88410000 14 Ellingworth Parade, Fax: +61-3-88410088 Box Hill, Vic, Australia, 3128 Web: www.network-box.com.au
This should be fixed in version 2.02, just sent to CPAN. Thanks!


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.