diff options
author | Matthew Somerville <matthew@mysociety.org> | 2017-01-03 17:14:11 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2017-01-03 17:14:11 +0000 |
commit | 0a5a8430025555ffef822345a4dc1f4474ef37b7 (patch) | |
tree | 9f3c8f1e9beb98dccb2434865a7a6ef00ddad607 /t | |
parent | cdaef42de3a3fe84b7764dc797a2f146dbe9d0be (diff) |
Fix bad cross-year test.
Make sure the tested date is in the same year as current.
Diffstat (limited to 't')
-rw-r--r-- | t/utils.t | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -78,7 +78,11 @@ if ($dt->day_of_week == 7) { # Sunday } is Utils::prettify_dt($dt), $dt->strftime("%H:%M, %A"); -$dt = DateTime->now->subtract(days => 100); +if ($dt->month == 1) { # January + $dt = DateTime->now->add(days => 30); +} else { + $dt = DateTime->now->subtract(days => 30); +} is Utils::prettify_dt($dt), $dt->strftime("%H:%M, %A %e %B %Y"); is Utils::prettify_dt($dt, "date"), $dt->strftime("%A %e %B %Y"); is Utils::prettify_dt($dt, "zurich"), $dt->strftime("%H:%M, %e. %B %Y"); |