Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 87769
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: zefram [...] fysh.org
Cc:
AdminCc:

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



Subject: day duration leads to invalid local time
Date: Sun, 11 Aug 2013 17:02:42 +0100
To: bug-DateTime [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
With DateTime-1.03: $dt0 = DateTime->new(year => 2013, month => 3, day => 30, hour => 1, time_zone => "Europe/London"); $dt1 = DateTime->new(year => 2013, month => 3, day => 31, hour => 2, time_zone => "Europe/London"); $dur = $dt1 - $dt0; # $dur is 1 day print $dt0 + $dur; # => Invalid local time for date in time zone: Europe/London As with the previous bug, this should be an easy case for duration arithmetic, because the duration is being used additively to represent the same calendar interval from which it was generated. $dur is sane in describing the interval as 1 day; the two times are exactly 24 hours apart. However, adding that day onto $dt0 requires accounting for the DST transition at the target time. ->add_duration is not in fact doing what ->subtract_datetime assumed it would, and so the addition and subtraction operations are mismatched. -zefram