aboutsummaryrefslogtreecommitdiffstats
path: root/t/utils.t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-02-07 10:58:48 +1300
committerStruan Donald <struan@exo.org.uk>2018-02-09 11:53:53 +1300
commitcfa53630e93e0be10a183a149ca4eba5424a6554 (patch)
treed0d8d1a13b99cc135f8194b85f0faef4aa559629 /t/utils.t
parent549d1cc66e591cf2da6b5243fbd28c7f40e75f14 (diff)
prevent timezone related util test failure
Make sure that the prettify_dt tests use the same timezone as FMS otherwise the test can fail if now in the local timezone is actually yesterday/tomorrow in the FMS timezone. Fixes #1984
Diffstat (limited to 't/utils.t')
-rw-r--r--t/utils.t4
1 files changed, 3 insertions, 1 deletions
diff --git a/t/utils.t b/t/utils.t
index f989580c8..aeaf225c7 100644
--- a/t/utils.t
+++ b/t/utils.t
@@ -67,7 +67,9 @@ is Utils::cleanup_text( "This has new\n\n\nlines in it", { allow_multiline => 1
is Utils::prettify_dt(), "[unknown time]";
-my $dt = DateTime->now;
+# Make sure we create the date using the FMS timezone that prettify_dt uses
+# otherwise this can fail if the local timezone is not the same as the FMS one
+my $dt = DateTime->now( time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone );
is Utils::prettify_dt($dt), $dt->strftime("%H:%M today");
# Same week test