aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-03-28 16:08:07 +0100
committerDave Arter <davea@mysociety.org>2018-03-29 16:04:32 +0100
commita540e87605871ffaa869cb987039d12c79f3b28c (patch)
tree525f94104a006e91b24e9f2e068ab68749095704 /perllib/FixMyStreet/App/Controller
parent307cc20b6ed92a983ba859ec5173066d68ec3aa9 (diff)
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
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index df4dc5f77..1646bc4d5 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -475,7 +475,13 @@ sub inspect : Private {
if ($update_text || %update_params) {
my $timestamp = \'current_timestamp';
if (my $saved_at = $c->get_param('saved_at')) {
- $timestamp = DateTime->from_epoch( epoch => $saved_at );
+ # this comes in as a UTC epoch but the database expects everything
+ # to have the FMS timezone so we need to add the timezone otherwise
+ # dates come back out the database at time +/- timezone offset.
+ $timestamp = DateTime->from_epoch(
+ time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone,
+ epoch => $saved_at
+ );
}
my $name = $c->user->from_body ? $c->user->from_body->name : $c->user->name;
$problem->add_to_comments( {