* Joshua Hoblitt ([EMAIL PROTECTED]) [26 Mar 2003 18:05]:
> * Dave Rolsky wrote:
[...]
> > Certainly. I was just proposing returning something _correct_, but a bit
> > unexpected.
> Something like this? I'll added tests if requested.
Or the other option:
(I make a clone so as to not disturb any setting the original may have)
Index: lib/DateTime/Format/ICal.pm
===================================================================
RCS file:
/cvsroot/perl-date-time/modules/DateTime-Format-ICal/lib/DateTime/Format/ICal.pm,v
retrieving revision 1.6
diff -u -r1.6 ICal.pm
--- lib/DateTime/Format/ICal.pm 16 Feb 2003 17:23:01 -0000 1.6
+++ lib/DateTime/Format/ICal.pm 26 Mar 2003 07:28:47 -0000
@@ -131,6 +131,10 @@
{
return 'TZID=' . $tz->name . ':' . $base;
}
+
+ my $rdt = $dt->clone;
+ $rdt->set_time_zone( 'UTC' );
+ return $self->format_datetime( $rdt );
}
sub format_duration
Index: t/01datetime.t
===================================================================
RCS file: /cvsroot/perl-date-time/modules/DateTime-Format-ICal/t/01datetime.t,v
retrieving revision 1.3
diff -u -r1.3 01datetime.t
--- t/01datetime.t 15 Feb 2003 06:01:54 -0000 1.3
+++ t/01datetime.t 26 Mar 2003 07:28:47 -0000
@@ -1,7 +1,8 @@
use strict;
-use Test::More tests => 33;
+use Test::More tests => 34;
+use DateTime;
use DateTime::Format::ICal;
my $ical = 'DateTime::Format::ICal';
@@ -76,3 +77,7 @@
is( $ical->format_datetime($dt), 'TZID=America/Chicago:00241121', 'output should
match input' );
}
+{
+ my $dt = DateTime->new(qw( year 1996 month 03 day 16 hour 13 minute 23 second 4
time_zone +1100 ));
+ is( $ical->format_datetime($dt), '19960316T022304Z', 'output should match input'
);
+}