Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: hatuka [...] nezumi.nu
Cc:
AdminCc:

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



Subject: format_datetime() generates slightly inappropriate results
Hi, The code use DateTime::Format::Mail; my $dt = DateTime->new( year => 2014, month => 4, day => 9, time_zone => 'GMT'); print DateTime::Format::Mail->format_datetime($dt), "\n"; outputs this. Wed, 09 Apr 2014 00:00:00 -0000 There are two problems. Important: * If time zone has no difference from UTC, it is formatted as "-0000", not "+0000". Relatively unimportant: * Day of month is always 2-digits such as "09". Though ABNF in RFC 822 and its successors allow it, examples appear in RFC 2822 and so on use 1-digit for the days before 10th. Regards, --- Soji
On Wed Apr 09 04:44:18 2014, NEZUMI wrote: Show quoted text
> > The code > > use DateTime::Format::Mail; > my $dt = DateTime->new( > year => 2014, > month => 4, > day => 9, > time_zone => 'GMT'); > print DateTime::Format::Mail->format_datetime($dt), > "\n"; > > outputs this. > > Wed, 09 Apr 2014 00:00:00 -0000 > > There are two problems. > > Important: > * If time zone has no difference from UTC, it is formatted as "-0000", > not "+0000". >
RFC 2822 states: The form "+0000" SHOULD be used to indicate a time zone at Universal Time. Though "-0000" also indicates Universal Time, it is used to indicate that the time was generated on a system that may be in a local time zone other than Universal Time and therefore indicates that the date-time contains no information about the local time zone. Which I think in this case means you're right. Show quoted text
> Relatively unimportant: > * Day of month is always 2-digits such as "09". Though ABNF in RFC > 822 and its successors allow it, examples appear in RFC 2822 and so on > use 1-digit for the days before 10th. >
This means replacing the "%a, %d %b %Y %H:%M:%S %z" format by "%a, %e %b %Y %H:%M:%S %z" -- BooK