=# UPDATE launches SET date_created = '20181212T00:00:01' WHERE id = 5;
UPDATE 1
but DateTime::Format::Pg doesn't:
cat tmp.pl
use strict;
use warnings;
use Test::More;
use Test::Exception;
use DateTime::Format::Pg 0.16013;
my $pg = DateTime::Format::Pg->new();
my $dt;
test('20200115T00:00:13');
test('20180115T00:00:13');
test('20130115T00:00:13');
test('2020-01-15T00:00:13');
done_testing;
sub test {
my $str = shift;
lives_ok( sub { $dt = $pg->parse_datetime($str) }, $str);
}
` carton exec -- perl tmp.pl
not ok 1 - 20200115T00:00:13
`Failed` test '20200115T00:00:13'
# at tmp.pl line 24.
# died: Invalid date format: 20200115T00:00:13 at tmp.pl line 24.
# Test::Exception::lives_ok() called at tmp.pl line 24
# main::test() called at tmp.pl line 12
not ok 2 - 20180115T00:00:13
# Failed test '20180115T00:00:13'
# at tmp.pl line 24.
# died: Invalid date format: 20180115T00:00:13 at tmp.pl line 24.
# Test::Exception::lives_ok() called at tmp.pl line 24
# main::test() called at tmp.pl line 14
not ok 3 - 20130115T00:00:13
# Failed test '20130115T00:00:13'
# at tmp.pl line 24.
# died: Invalid date format: 20130115T00:00:13 at tmp.pl line 24.
# Test::Exception::lives_ok() called at tmp.pl line 24
# main::test() called at tmp.pl line 16
ok 4 - 2020-01-15T00:00:13
1..4
Hi,
Psql (9.6.8) supports this format:
=# UPDATE launches SET date_created = '20181212T00:00:01' WHERE id = 5; UPDATE 1
but DateTime::Format::Pg doesn't: