Sorry, I wasn't on a computer with git at the time. Attached is the patch.
From 28d77c6e197d524525784c9f11343798a9eb337d Mon Sep 17 00:00:00 2001
From: Douglas Christopher Wilson <doug@somethingdoug.com>
Date: Thu, 21 Oct 2010 13:20:09 -0400
Subject: [PATCH] Fix issue where format_isoz() did not change the time zone to UTC
---
lib/DateTime/Format/HTTP.pm | 2 +-
t/date.t | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/lib/DateTime/Format/HTTP.pm b/lib/DateTime/Format/HTTP.pm
index 0670927..bad6aca 100644
--- a/lib/DateTime/Format/HTTP.pm
+++ b/lib/DateTime/Format/HTTP.pm
@@ -91,7 +91,7 @@ sub format_isoz
{
my ($self, $dt) = @_;
$dt = DateTime->now unless defined $dt;
- $dt->clone->set_time_zone( 'UTC' );
+ $dt = $dt->clone->set_time_zone( 'UTC' );
sprintf("%04d-%02d-%02d %02d:%02d:%02dZ",
$dt->year, $dt->month, $dt->day,
$dt->hour, $dt->min, $dt->sec
diff --git a/t/date.t b/t/date.t
index 3162249..b5a8f3f 100644
--- a/t/date.t
+++ b/t/date.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
use lib 'inc';
-use Test::More tests => 116;
+use Test::More tests => 118;
use vars qw( $class );
BEGIN {
@@ -171,3 +171,25 @@ for ($a, $b) {
for ($az, $bz) {
like( $_ => qr/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\dZ$/, "time2isoz($_)" );
}
+
+{
+ # format_isoz must output date in UTC
+ my $eastern_date = DateTime->new(
+ year => 2010,
+ month => 10,
+ day => 21,
+ hour => 13,
+ minute => 8,
+ second => 23,
+ time_zone => 'America/New_York',
+ );
+
+ # Get the ISO "Z" format of the eastern zone date time
+ my $isoz = $class->format_isoz($eastern_date);
+
+ # Get the actual UTC date time
+ my $utc = $eastern_date->clone->set_time_zone('UTC');
+
+ is($isoz, $class->format_isoz($utc), 'format_isoz converts to UTC time zone');
+ is($eastern_date->time_zone->name, 'America/New_York', 'format_isoz does not modify input date\'s time zone');
+}
--
1.7.3.1.msysgit.0