if ($type eq "timestamp with time zone" || $type eq "timestamptz") {
$type = "timestamp";
$info->{_ic_dt_method} ||= "timestamp_with_timezone";
+ } elsif ($type eq "timestamp without time zone") {
+ $type = "timestamp";
+ $info->{_ic_dt_method} ||= "timestamp_without_timezone";
} elsif ($type eq "smalldatetime") {
$type = "datetime";
$info->{_ic_dt_method} ||= "datetime";
eval { require DateTime::Format::Pg };
plan $@
? ( skip_all => 'Need DateTime::Format::Pg for timestamp inflation tests')
- : ( tests => 3 )
+ : ( tests => 6 )
;
is($event->created_on->time_zone->name, "America/Chicago", "Timezone changed");
# Time zone difference -> -6hours
is($event->created_on->iso8601, "2009-01-15T11:00:00", "Time with TZ correct");
+
+# test 'timestamp without time zone'
+ my $dt = DateTime->from_epoch(epoch => time);
+ $dt->set_nanosecond(int 500_000_000);
+ $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, $dt, 'timestamp without time zone inflation');
+ is($event->ts_without_tz->microsecond, $dt->microsecond,
+ 'timestamp without time zone microseconds survived');
}
varchar_date => { data_type => 'varchar', inflate_date => 1, size => 20, is_nullable => 1 },
varchar_datetime => { data_type => 'varchar', inflate_datetime => 1, size => 20, is_nullable => 1 },
skip_inflation => { data_type => 'datetime', inflate_datetime => 0, is_nullable => 1 },
+ ts_without_tz => { data_type => 'datetime', is_nullable => 1 }, # used in EventTZPg
);
__PACKAGE__->set_primary_key('id');
id => { data_type => 'integer', is_auto_increment => 1 },
starts_at => { data_type => 'datetime', timezone => "America/Chicago", locale => 'de_DE' },
created_on => { data_type => 'timestamp with time zone', timezone => "America/Chicago" },
+ ts_without_tz => { data_type => 'timestamp without time zone' },
);
__PACKAGE__->set_primary_key('id');