1 use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt_pg';
11 DBICTest::Schema->load_classes('EventTZPg');
13 my $schema = DBICTest->init_schema();
16 my $event = $schema->resultset("EventTZPg")->find(1);
17 $event->update({created_on => '2009-01-15 17:00:00+00'});
18 $event->discard_changes;
19 isa_ok($event->created_on, "DateTime") or diag $event->created_on;
20 is($event->created_on->time_zone->name, "America/Chicago", "Timezone changed");
21 # Time zone difference -> -6hours
22 is($event->created_on->iso8601, "2009-01-15T11:00:00", "Time with TZ correct");
24 # test 'timestamp without time zone'
25 my $dt = DateTime->from_epoch(epoch => time);
26 $dt->set_nanosecond(int 500_000_000);
27 $event->update({ts_without_tz => $dt});
28 $event->discard_changes;
29 isa_ok($event->ts_without_tz, "DateTime") or diag $event->created_on;
30 is($event->ts_without_tz, $dt, 'timestamp without time zone inflation');
31 is($event->ts_without_tz->microsecond, $dt->microsecond,
32 'timestamp without time zone microseconds survived');
33 } [], 'No warnings during DT manipulations';