test: fix the day of the Reports period tests in local time (#479)
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 2m35s

resolveReportsPeriod reads the local date of the day it is given, and
the fixture was noon UTC: April 15 already in UTC+12 and beyond. Harmless
while the tests only read the year, it turned six of the new exact-date
cases red under TZ=Pacific/Auckland (found in the self-review, replayed).
The fixture is now local noon, April 14 in every time zone; the seven
test files of #479 pass from UTC-11 to UTC+14.

Resolves #479

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-10-27 23:13:07 -04:00
commit 9b03a710e9

View file

@ -3,8 +3,9 @@ import { resolveReportsPeriod, parseAccountIds, serializeAccountIds } from "./us
describe("resolveReportsPeriod", () => {
// A day far from the clock: a range computed from `new Date()` instead of
// the given day ends elsewhere, and these tests go red.
const fixedToday = new Date("2026-04-14T12:00:00Z");
// the given day ends elsewhere, and these tests go red. Local noon, so it is
// April 14 in every time zone (noon UTC is already April 15 in UTC+12).
const fixedToday = new Date(2026, 3, 14, 12);
/** « Cette année » on that day: January 1st to that day (#479). */
const YEAR_TO_DATE = { from: "2026-01-01", to: "2026-04-14", period: "year" };