Skip Menu |

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

Report information
The Basics
Id: 61969
Status: rejected
Priority: 0/
Queue: DateTime-Format-RFC3339

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

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



Subject: Return +00:00 offset as Z
Reading RFC3339 and http://www.w3.org/TR/NOTE-datetime which is derived from ISO8601, I'm led to believe the correct behaviour when dealing with a +00:00 offset is to return Zulu time... [ DateTime->new( year => 2002, month => 1, day => 1, hour => 13, minute => 50, second => 5, time_zone => 'Europe/London' ), '2002-01-01T13:50:05Z', ] Thanks!
Patch for said bug/feature attached. Hope that's ok!
Subject: rfc3339_zulu.patch
From 34ad5c9ed1923269c1ed78e47449dc3e28a60719 Mon Sep 17 00:00:00 2001 From: Yoav Felberbaum <mrdini@alembic.dreamhost.com> Date: Fri, 8 Oct 2010 07:21:04 -0700 Subject: [PATCH] Changes for 1.0.4 hopefully --- lib/DateTime/Format/RFC3339.pm | 2 +- t/02_formatting.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/DateTime/Format/RFC3339.pm b/lib/DateTime/Format/RFC3339.pm index fadca18..8170972 100644 --- a/lib/DateTime/Format/RFC3339.pm +++ b/lib/DateTime/Format/RFC3339.pm @@ -79,7 +79,7 @@ sub format_datetime { my $mins = int($secs / 60); $secs %= 60; my $hours = int($mins / 60); $mins %= 60; ++$mins if $secs >= 30; - $tz = sprintf('%s%02d:%02d', $sign, $hours, $mins); + $tz = ($hours == '00' && $mins == '00') ? 'Z' : sprintf('%s%02d:%02d', $sign, $hours, $mins); } return diff --git a/t/02_formatting.t b/t/02_formatting.t index 9e4d8e1..451b6a3 100644 --- a/t/02_formatting.t +++ b/t/02_formatting.t @@ -19,7 +19,7 @@ BEGIN { ], [ DateTime->new( year => 2002, month => 1, day => 1, hour => 13, minute => 50, second => 5, time_zone => 'Europe/London' ), - '2002-01-01T13:50:05+00:00', + '2002-01-01T13:50:05Z', ], [ DateTime->new( year => 2002, month => 1, day => 1, hour => 13, minute => 50, second => 5, time_zone => 'America/New_York' ), -- 1.7.1.1
On Thu Oct 07 16:02:36 2010, MRDINI wrote: Show quoted text
> Reading RFC3339 and http://www.w3.org/TR/NOTE-datetime which is derived > from ISO8601, I'm led to believe the correct behaviour when dealing with > a +00:00 offset is to return Zulu time...
I see no such requirement. As a counter example, RFC3339 says <<This differs semantically from an offset of "Z" or "+00:00">>, which means "+00:00" is quite valid. Based on an email you sent me, the disconnect seems to be that you mistakenly took "integral" to mean "non-zero". The module consciously uses "Z" for UTC and "+XX:YY" for local time zones. I believe this provides the most useful output. It's very easy to convert to UTC first if "Z" is desired. At this time, I'd rather not change the behaviour. - Eric PS - The behaviour of the module with non-integral offset minutes is suboptimal. It should convert those to UTC rather than do rounding. I'll be fixing this right away.