Skip Menu |

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

Report information
The Basics
Id: 90497
Status: resolved
Priority: 0/
Queue: DateTime-Format-Mail

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

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



Subject: Can't parse time where hour is 1 digit
All these dates fail to be parsed, but will succeed when zero prefix "0" is added to the hour. They are from production (encountered in real incoming mail headers). For quick fix on my part, I add these zero prefix myself before feeding to parse_datetime(). Tue, 19 Nov 2013 1:32:39 +0000 Tue, 19 Nov 2013 1:01:14 +0000 Tue, 19 Nov 2013 3:36:07 +0700 Tue, 19 Nov 2013 2:12:11 +0400 Regards, Steven
On Tue Nov 19 05:18:17 2013, SHARYANTO wrote: Show quoted text
> All these dates fail to be parsed, but will succeed when zero prefix > "0" is added to the hour. They are from production (encountered in > real incoming mail headers). For quick fix on my part, I add these > zero prefix myself before feeding to parse_datetime(). > > Tue, 19 Nov 2013 1:32:39 +0000 > Tue, 19 Nov 2013 1:01:14 +0000 > Tue, 19 Nov 2013 3:36:07 +0700 > Tue, 19 Nov 2013 2:12:11 +0400 >
Did you try to use the 'loose' parameter? Either with: my $p = DateTime::Format::Mail->new( loose => 1 ); or my $p = DateTime::Format::Mail->new->loose; I checked the regexp used for the loose parser, and it supports one digit hours. I also added your sample dates to the test script, and it passed (using the loose parameter).
On Tue Nov 19 11:31:24 2013, BOOK wrote: Show quoted text
> On Tue Nov 19 05:18:17 2013, SHARYANTO wrote:
> > All these dates fail to be parsed, but will succeed when zero prefix > > "0" is added to the hour. They are from production (encountered in > > real incoming mail headers). For quick fix on my part, I add these > > zero prefix myself before feeding to parse_datetime(). > > > > Tue, 19 Nov 2013 1:32:39 +0000 > > Tue, 19 Nov 2013 1:01:14 +0000 > > Tue, 19 Nov 2013 3:36:07 +0700 > > Tue, 19 Nov 2013 2:12:11 +0400 > >
> > Did you try to use the 'loose' parameter? > > Either with: > > my $p = DateTime::Format::Mail->new( loose => 1 ); > > or > > my $p = DateTime::Format::Mail->new->loose; > > I checked the regexp used for the loose parser, and it supports one > digit hours. > > I also added your sample dates to the test script, and it passed > (using the loose parameter).
I didn't and I should. Thanks :) Regards, Steven