[Jifty-commit] r4244 - in Jifty-DBI/trunk: lib/Jifty/DBI/Filter
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Oct 16 17:15:59 EDT 2007
Author: sartak
Date: Tue Oct 16 17:15:59 2007
New Revision: 4244
Modified:
Jifty-DBI/trunk/ (props changed)
Jifty-DBI/trunk/lib/Jifty/DBI/Filter/DateTime.pm
Log:
r43744 at onn: sartak | 2007-10-16 17:15:17 -0400
Two fixes for timezones:
* Coerce input and output to be UTC (or Floating, if JDBI::Filter::Date)
I think we were depending on DT:F:Strptime being saner than it is
* Use set_time_zone, not time_zone which is only a getter
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Filter/DateTime.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Filter/DateTime.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Filter/DateTime.pm Tue Oct 16 17:15:59 2007
@@ -9,7 +9,7 @@
use DateTime::Format::Strptime ();
use Carp ();
-use constant _time_zone => '';
+use constant _time_zone => 'UTC';
use constant _strptime => '%Y-%m-%d %H:%M:%S';
@@ -23,6 +23,9 @@
plain text dates. If the column type is "date", then the hour,
minute, and second information is discarded when encoding.
+Both input and output will always be coerced into UTC (or, in the case of
+Dates, the Floating timezone) for consistency.
+
=head2 encode
If value is DateTime object then converts it into ISO format
@@ -49,8 +52,8 @@
return unless $$value_ref;
if (my $tz = $self->_time_zone) {
- $$value_ref = $$value_ref->clone;
- $$value_ref->time_zone('floating');
+ $$value_ref = $$value_ref->clone;
+ $$value_ref->set_time_zone($tz);
}
$$value_ref = $$value_ref->strftime($self->_strptime);
return 1;
More information about the Jifty-commit
mailing list