Subject: | ->next is not taking timezones into account |
It would appear that next() calculations are not taking time zones into
account. Here is a simple test:
use strict;
use warnings;
use DateTime;
use DateTime::Incomplete;
use Test::More;
# 2011-03-29 00:00:00
my $dt = DateTime->new(year => 2011, month => 03, day => 29,
time_zone => 'UTC');
# Sao Paolo is UTC-03
my $dti = DateTime::Incomplete->new(hour => 7);
# when is it next 7am in Brazil? ... should be 4am UTC.
my $next = $dti->next($dt);
#use Data::Dumper;
#print "### next: ", Dumper($next);
is(ref($next->time_zone), 'DateTime::TimeZone::UTC', '$dt timezone
is UTC');
is($next->hour, 4, '7am in Brazil is 4am UTC');
done_testing;
Have I misunderstood the documentation? It should be possible to pass a
$dt into next() with a different timezone than the $dti object.