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

Owner: Nobody in particular
Requestors: steven.lynch [...]

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 [...]
From: Steven Lynch <steven.lynch [...]>
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: Network Box Australia Pty Ltd Phone: +61-3-88410000 14 Ellingworth Parade, Fax: +61-3-88410088 Box Hill, Vic, Australia, 3128 Web:
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 infrastructure.

Please report any issues with to