Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 92445
Status: resolved
Priority: 0/
Queue: DateTime-Format-Strptime

People
Owner: Nobody in particular
Requestors: rjbs [...] cpan.org
Cc:
AdminCc:

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



Subject: using %H instead of %l with %p leads to silent failure
Download (untitled) / with headers
text/plain 689b
This works: DB<20> p $f = DateTime::Format::Strptime->new(pattern => "%Y-%m-%d %l:%M %p", time_zone => 'Europe/Berlin' )->parse_datetime("2014-01-24 2:20 PM") 2014-01-24T14:20:00 This is pretty surprising, actually, to begin with, because for the hours I have %l (that's a lower case L as in Lima). Not documented! Anyway, works with %I (as in India) also. This doesn't: DB<25> p $f = DateTime::Format::Strptime->new(pattern => "%Y-%m-%d %H:%M %p", time_zone => 'Europe/Berlin' )->parse_datetime("2014-01-24 2:20 PM") Silent failure, here, seems like a bummer. I realize that "23:01 AM" would be nonsensical, but… maybe a warning? I dunno. -- rjbs
On Fri Jan 24 15:15:18 2014, RJBS wrote: Show quoted text
> This works: > > DB<20> p $f = DateTime::Format::Strptime->new(pattern => "%Y-%m-%d > %l:%M %p", time_zone => 'Europe/Berlin' )->parse_datetime("2014-01-24 > 2:20 PM") > 2014-01-24T14:20:00 > > This is pretty surprising, actually, to begin with, because for the > hours I have %l (that's a lower case L as in Lima). Not documented! > Anyway, works with %I (as in India) also. > > This doesn't: > > DB<25> p $f = DateTime::Format::Strptime->new(pattern => "%Y-%m-%d > %H:%M %p", > time_zone => 'Europe/Berlin' )->parse_datetime("2014-01-24 > 2:20 PM") > > Silent failure, here, seems like a bummer. I realize that "23:01 AM" > would be nonsensical, but… maybe a warning? I dunno.
I agree, this is goofy. I note that internally the code treats %l and %I the same, though this is undocumented (and probably wrong, since one is 01-12 and the other is " 1"-12. Anyway, this code probably need a rewrite before I can fix this, since I honestly have no clue what's going on the body of the parser.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.