lestrrat-p5 / DateTime-Format-Pg

Other
2 stars 5 forks source link

Amountless units don't croak #8

Closed ralesk closed 8 years ago

ralesk commented 8 years ago

Apparently if you forget to supply an amount to a unit, parse_duration will happily create a 0 duration object.

my $duration = DateTime::Format::Pg->parse_interval("2 hello"); ## dies with Unknown timespec
my $duration2 = DateTime::Format::Pg->parse_interval("hello"); ## Contains a 0 duration
my $duration3 = DateTime::Format::Pg->parse_interval("-days"); ## Contains a 0 duration 
christopherraa commented 8 years ago

This was introduced between DateTime-Format-Pg-0.16009 (working as expected) and DateTime-Format-Pg-0.16011 (not working as expected).

lestrrat commented 8 years ago

Apologies, had not noticed this issue :/

lestrrat commented 8 years ago

@ralesk @christopherraa can you please check the above PR?