Subject: | Mail::Message::Field::toDate() generates dates which are not parsed by Mail::Message::timestamp() |
Mail::Message::Field::toDate() generates dates which are not parsed by Mail::Message::timestamp() afterwhile on my system (WinXP/Russian locale).
Mail::Message::timestamp() uses Date::parse::str2time() to parse 'date' header and this fails on 'Wed, 06 Oct 2004 13:14:22 Russian Daylight Time'.
Work around is to explicit specify date like
my $msg = Mail::Message->build(Subject => 'foo',
Date => time2str("%a, %e %b %Y %T %z", time()));
But may be it's worth using Date::Format::time2str() just to be symmetric with Mail::Message::Field::dateToTimestamp() which uses Date::Parse::str2time()?
Code snippet:
use Mail::Message::Field;
use Date::Format qw(time2str);
use Date::Parse qw(str2time);
my $date1 = Mail::Message::Field->toDate, "\n";
my $date2 = time2str("%a, %e %b %Y %T %z", time()), "\n";
my $stamp1 = str2time($date1, 'GMT') || 'oops!';
my $stamp2 = str2time($date2, 'GMT') || 'oops!';
print "Time stamp for '$date1': $stamp1\n";
print "Time stamp for '$date2': $stamp2\n";
Does on my system:
Time stamp for 'Wed, 06 Oct 2004 13:32:00 Russian Daylight Time': oops!
Time stamp for 'Wed, 6 Oct 2004 13:32:00 +0400': 1097055120
Thanks a lot for your previous quick responses.