Hello all,
I am trying to implement in Act, the software behind most Perl
conference sites, a feature someone asked for: timezone in the iCal
export (which is generated with Data::ICal).
Looking at the iCal specification, it appears I must define the
timezone (VTIMEZONE) with the daylight and standard events.
DateTime::TimeZone has all the required information, but does not
provide a public API to do this. However, after trying enough time, I
found how to get the information I need:
use DateTime;
use DateTime::TimeZone;
my $zone_name = "Europe/Paris";
my $tz = DateTime::TimeZone->new(name => $zone_name);
my $dt = DateTime->now(time_zone => $zone_name);
my $curr_span = $tz->_span_for_datetime(local => $dt);
my $next_span = $tz->_generate_next_span;
my %span;
if ($curr_span->[IS_DST]) {
$span{daylight} = $curr_span;
$span{standard} = $next_span;
}
else {
$span{daylight} = $next_span;
$span{standard} = $curr_span;
}
... except I have no idea how to convert the values from UTC_START or
LOCAL_START to something usable. DateTime::Format::Epoch lead to no
success.
Hence my question: how to convert the value in UTC_START /
LOCAL_START to a DateTime object?
Thanks in advance
--
Sébastien Aperghis-Tramoni
Close the world, txEn eht nepO.