Subject: | Parsing dates of broken mail clients |
Date: | Thu, 04 Jul 2013 22:52:22 +0100 |
To: | bug-Mail-Box [...] rt.cpan.org |
From: | Andrew Beverley <andy [...] andybev.com> |
Some broken mail clients drop the leading zero of the time in a message.
For example: "Date: Tue, 2 Jul 2013 1:53:23 +0000". This is currently
parsed as "02 Saturday 00:00 LMT". This patch provides a workaround and
fixes that behaviour.
--- lib/Mail/Message/Field/Date.pm 2013-06-25 08:23:05.000000000 +0100
+++ lib/Mail/Message/Field/Date-new.pm 2013-07-04 22:49:13.733368821
+0100
@@ -30,7 +30,7 @@
( 0?[1-9] | [12][0-9] | 3[01] ) \s* # day
\s+ ( [A-Z][a-z][a-z] ) \s+ # month
( 19[0-9][0-9] | 2[0-9]{3} ) \s+ # year
- ( [0-1][0-9] | 2[0-3] ) \s* # hour
+ ( [0-1]?[0-9] | 2[0-3] ) \s* # hour
\: ( [0-5][0-9] ) \s* # minute
(?: \: ( [0-5][0-9] ) )? \s+ # second
( [+-][0-9]{4} | [A-Z]+ )? # zone