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: 20697
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: cpan [...] prather.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.31
  • 0.32
Fixed in: 0.33



Subject: Issues with DateMath on DST change over day(s)
Trying to perform what we think is a valid subtraction on April 3, 2005 causes DateTime to report unusual values. The attached test subtracts 7am from 8am which should yield 60 minute difference, but instead reports 0 minutes. It then attempts to subtract 7am from 7am, expecting to get 0 minute duration but instead gets 1380 minutes. Something clearly isn't right with either our understanding of the docs, or with DateTime on Daylight Savings Time changeover days.
Subject: spring_ahead.pl
#!/usr/local/bin/perl5 use strict; use warnings; use DateTime; use Test::More qw(no_plan); diag "DateTime version ", $DateTime::VERSION, "\n"; my $dt1 = DateTime->new( year => 2005, month => 4, day => 3, hour => 7, minute => 0, time_zone => "America/New_York" ) or die "DateTime object creation failed"; my $dt2 = DateTime->new( year => 2005, month => 4, day => 3, hour => 8, minute => 0, time_zone => "America/New_York" ) or die "DateTime object creation failed"; diag "dt1 is ", $dt1->strftime("%Y-%b-%d %T %Z"), "\n"; diag "dt2 is ", $dt2->strftime("%Y-%b-%d %T %Z"), "\n"; { my $dur = $dt2 - $dt1; my ($minutes, $seconds) = $dur->in_units('minutes','seconds'); #diag "dt2 - dt1 = $minutes minutes, $seconds seconds\n"; is($minutes, 60); is($seconds, 0); } { my $dur = $dt1 - $dt1; my ($minutes, $seconds) = $dur->in_units('minutes','seconds'); #diag "dt1 - dt1 = $minutes minutes, $seconds seconds\n"; is($minutes, 0); is($seconds, 0); }
Subject: Re: [rt.cpan.org #20697] Issues with DateMath on DST change over day(s)
Date: Mon, 31 Jul 2006 06:06:42 -0500 (CDT)
To: via RT <bug-DateTime [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Wed, 26 Jul 2006, via RT wrote: Show quoted text
> Trying to perform what we think is a valid subtraction on April 3, 2005 > causes DateTime to report unusual values. > > The attached test subtracts 7am from 8am which should yield 60 minute > difference, but instead reports 0 minutes. > > It then attempts to subtract 7am from 7am, expecting to get 0 minute > duration but instead gets 1380 minutes. > > Something clearly isn't right with either our understanding of the docs, > or with DateTime on Daylight Savings Time changeover days.
This is definitely a bug. I'll be releasing afixed version sometime in the next week or two. -dave