Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime-Format-Pg CPAN distribution.

Report information
The Basics
Id: 42499
Status: open
Priority: 0/
Queue: DateTime-Format-Pg

People
Owner: Nobody in particular
Requestors: cpan-20090118-7280 [...] gheift.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [DateTime::Format::Pg] uninitialized year in _fix_timezone on parse_datetime('14:00:00')
Date: Sun, 18 Jan 2009 19:30:46 +0100
To: bug-DateTime-Format-Pg [...] rt.cpan.org
From: Gerhard Heift <cpan-20090118-7280 [...] gheift.de>
Hello, I use DateTime::Format::Pg and tried to parse a time without time zone via DateTime::Format::Pg->parse_datetime('12:00:00'); This throws me a warning: Use of uninitialized value in numeric lt (<) at /usr/share/perl5/DateTime/Format/Pg.pm line 324 sub _fix_timezone This happens, because the year field in extra is not yet added to the parsed hash and the time_zone is undefined. I could use parse_time, but I want to keep parse_datetime for parsing my date and time values. Is it possible to fix it upstream? I just added following: if(!defined($args{'parsed'}->{'time_zone'})) { # For very early and late dates, PostgreSQL always returns times in # UTC and does not tell us that it did so. + if (! defined $args{'parsed'} ) { + # time without timezone, so add floating, see parse_time + $args{'parsed'}->{'time_zone'} = 'floating'; + } + + elsif ( $args{'parsed'}->{'year'} < 1901 - if ( $args{'parsed'}->{'year'} < 1901 || ( $args{'parsed'}->{'year'} == 1901 && ($args{'parsed'}->{'month'} < 12 || $args{'parsed'}->{'day'} < 14) ) Regards Gerhard Heift
Download signature.asc
application/pgp-signature 197b

Message body not shown because it is not plain text.

You probably want to use s parse_time_without_time_zone() instead of parse_datetime(). Let me know if that solves the problem (and it would be nice if you could give me a test case if that still doesn't solve your problem)