From a540e87605871ffaa869cb987039d12c79f3b28c Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 28 Mar 2018 16:08:07 +0100 Subject: fix timezone problems with offline inspector comments Comments added offline by an inspector set the time in JavaScript using a UTC epoch. We need to add the FMS timezone to this so it's in the timezone the database expects for timestamps otherwise it's incorrect when we fetch it back out --- t/app/controller/report_inspect.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 't/app/controller') diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 39dd57444..5447c744e 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -613,7 +613,11 @@ FixMyStreet::override_config { subtest "test saved-at setting" => sub { $report->comments->delete; $mech->get_ok("/report/$report_id"); - my $now = DateTime->now->subtract(days => 1); + # set the timezone on this so the date comparison below doesn't fail due to mismatched + # timezones + my $now = DateTime->now( + time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone + )->subtract(days => 1); $mech->submit_form(button => 'save', form_id => 'report_inspect_form', fields => { include_update => 1, public_update => 'An update', saved_at => $now->epoch }); $report->discard_changes; -- cgit v1.2.3