Skip to content

Commit 3449989

Browse files
author
Eugen Konkov
committed
Use the same formatter for the inflated DataTime object as for underlyed database.
1 parent adaf62b commit 3449989

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/DBIx/Class/InflateColumn/DateTime.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ sub _post_inflate_datetime {
246246

247247
$dt->set_time_zone($info->{timezone}) if defined $info->{timezone};
248248
$dt->set_locale($info->{locale}) if defined $info->{locale};
249+
my $f = defined $info->{formatter} && $info->{formatter}
250+
|| $ENV{DBIC_AUTOSET_DATETIME_FORMATTER} && 'auto';
251+
if( $f ) {
252+
$f = $f eq 'auto' ? $self->_datetime_parser : $f;
253+
$dt->set_formatter( $f );
254+
}
249255

250256
return $dt;
251257
}

0 commit comments

Comments
 (0)