From bb979a8ed14facc072593efa797d09abe9b93592 Mon Sep 17 00:00:00 2001 From: Eugen Konkov Date: Wed, 28 Oct 2020 18:48:09 +0200 Subject: [PATCH 1/2] DateTime::Format::* does not have parse_timestamp_without_timezone method The timezone should be spelled as 'time_zone'. https://metacpan.org/pod/DateTime::Format::Pg#PARSING-METHODS --- lib/DBIx/Class/InflateColumn/DateTime.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/DBIx/Class/InflateColumn/DateTime.pm b/lib/DBIx/Class/InflateColumn/DateTime.pm index 7abf5acfe..2ab1161e5 100644 --- a/lib/DBIx/Class/InflateColumn/DateTime.pm +++ b/lib/DBIx/Class/InflateColumn/DateTime.pm @@ -132,10 +132,10 @@ sub register_column { # _ic_dt_method will follow whatever the registration requests # thus = instead of ||= if ($data_type eq 'timestamp with time zone' || $data_type eq 'timestamptz') { - $info->{_ic_dt_method} = 'timestamp_with_timezone'; + $info->{_ic_dt_method} = 'timestamp_with_time_zone'; } elsif ($data_type eq 'timestamp without time zone') { - $info->{_ic_dt_method} = 'timestamp_without_timezone'; + $info->{_ic_dt_method} = 'timestamp_without_time_zone'; } elsif ($data_type eq 'smalldatetime') { $info->{_ic_dt_method} = 'smalldatetime'; From c58f24e5dd84e1281d2d9c7648425d1fdb9051c3 Mon Sep 17 00:00:00 2001 From: Eugen Konkov Date: Sat, 5 Apr 2025 22:05:59 -0400 Subject: [PATCH 2/2] For DateTime without timezone there should not be any specific name --- t/inflate/datetime_pg.t | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/inflate/datetime_pg.t b/t/inflate/datetime_pg.t index 7a30e42f5..fdd025147 100644 --- a/t/inflate/datetime_pg.t +++ b/t/inflate/datetime_pg.t @@ -30,9 +30,11 @@ warnings_are { # test 'timestamp without time zone' my $dt = DateTime->from_epoch(epoch => time); $dt->set_nanosecond(int 500_000_000); + $dt->set_time_zone( "Europe/Zaporozhye" ); $event->update({ts_without_tz => $dt}); $event->discard_changes; isa_ok($event->ts_without_tz, "DateTime") or diag $event->created_on; + is($event->ts_without_tz->time_zone->name, "floating", "No specific timezone"); is($event->ts_without_tz, $dt, 'timestamp without time zone inflation'); is($event->ts_without_tz->microsecond, $dt->microsecond, 'timestamp without time zone microseconds survived');