I was trying to answer this question on how to parse an incomplete date:
http://www.perlmonks.org/?node_id=1163514

I've tried this:

use DateTime::Format::ISO8601;
use DateTime::Incomplete;
use DateTime::TimeZone;
use Data::Dumper;

my $tz = DateTime::TimeZone->new( name => "America/New_York" );
my $base_datetime = DateTime::Incomplete->new( time_zone => $tz );
my $iso8601 = DateTime::Format::ISO8601->new( base_datetime =>
$base_datetime, );
my $dt = DateTime::Format::ISO8601->parse_datetime( "2016" );
print Dumper({ year => $dt->year, month => $dt->month, day => $ft->day });

The time_zone parameter seems to be required by DateTime.pm, I get an
error otherwise.

It seems to enter an infinite loop, I couldn't investigate enough yet.

Reply via email to