Just to be clear, this is the native behavior of DateTime::Set, rather than something that DateTime::Event::Cron is introducing into the sets it generates. Using your same example, but replacing the cron set with an actual (monthly) recurrence set, we see the same behavior:

---

$set = DateTime::Set->from_recurrence(
 recurrence => sub {
   return $_[0] if $_[0]->is_infinite;
   return $_[0]->truncate( to => 'month' )->add( months => 1 )
 },
);

$now = DateTime->now();
$next = $set->next($now);
print $next->strftime( "%a %F %T %Z\n");
# Thu 2004-06-24 18:15:00 UTC
# but it should be floating time

$set = $set->set_time_zone('Europe/London');

$now = DateTime->now();
$next = $set->next($now);
print $next->strftime( "%a %F %T %Z\n");
# Thu 2004-06-24 19:15:00 GMT/BST
# because it converted UTC=>BST,
# instead of float=>BST

$now = DateTime->now(time_zone => 'Europe/Berlin');
$next = $set->next($now);
print $next->strftime( "%a %F %T %Z\n");
# Thu 2004-06-24 17:15:00 GMT/BST
# but it should be CEST

---

Cheers,
Matt



Reply via email to