Traewelling can't seem to decide on date formats

This commit is contained in:
Daniel Friesel 2020-10-04 13:05:06 +02:00
parent ce88fe440c
commit 9ad3b3c9e8

View file

@ -47,18 +47,29 @@ sub get_status_p {
}
else {
if ( my $status = $tx->result->json->{statuses}{data}[0] ) {
my $strp = DateTime::Format::Strptime->new(
my $strp1 = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%dT%H:%M:%S.000000Z',
time_zone => 'UTC',
);
my $strp2 = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d %H:%M:%S',
time_zone => 'Europe/Berlin',
);
my $status_id = $status->{id};
my $message = $status->{body};
my $checkin_at
= $strp->parse_datetime( $status->{created_at} );
= $strp1->parse_datetime( $status->{created_at} )
// $strp2->parse_datetime( $status->{created_at} );
my $dep_dt = $strp->parse_datetime(
my $dep_dt
= $strp1->parse_datetime(
$status->{train_checkin}{departure} )
// $strp2->parse_datetime(
$status->{train_checkin}{departure} );
my $arr_dt = $strp->parse_datetime(
my $arr_dt
= $strp1->parse_datetime(
$status->{train_checkin}{arrival} )
// $strp2->parse_datetime(
$status->{train_checkin}{arrival} );
my $dep_eva