Here's an easy way to implement default timezone support for
InflateColumn::DateTime. Add a field info parameter 'time_zone'
in the column definition, if you want one.
set_time_zone bombs on undef so it cannot use chained methods.
Mark
--- /tmp/DateTime.pm 2006-08-10 18:37:29.000000000 -0700
+++ /usr/local/share/perl/5.8.8/DBIx/Class/InflateColumn/DateTime.pm
2006-08-10 18:45:34.000000000 -0700
@@ -60,7 +60,10 @@
{
inflate => sub {
my ($value, $obj) = @_;
- $obj->_datetime_parser->$parse($value);
+ my $dt = $obj->_datetime_parser->$parse($value);
+ my $tz = $info->{time_zone};
+ $dt->set_time_zone( $tz ) if $tz;
+ return $dt;
},
deflate => sub {
my ($value, $obj) = @_;
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/