fix: chronological order test fails in UTC environments

The test called getTimes without an explicit tz, so it fell back to
-date.getTimezoneOffset()/60. On the developer machine (EDT = UTC-4)
this worked; on CI (Ubuntu, UTC = 0) NY's Maghrib crossed midnight,
returning ~0.51h instead of ~24.5h, which sorted before Asr (~21h).

Add tz=-4 explicitly. All section-8 geographic tests already do this;
the chronological test was the only one missing it.
This commit is contained in:
Aric Camarata 2026-02-25 18:34:59 -05:00
parent c02f197ece
commit a8d15bc85d

View file

@ -309,7 +309,9 @@ test('getTimes returns all required fields', () => {
});
test('getTimes chronological order', () => {
const t = getTimes(new Date('2024-06-21'), 40.7, -74.0);
// Use explicit tz=-4 (EDT) so CI (UTC) and local machines give identical results.
// Without it, NY's Maghrib falls past UTC midnight, wrapping to ~0.5h < Asr(~21h).
const t = getTimes(new Date('2024-06-21'), 40.7, -74.0, -4);
// Fajr < Sunrise < Noon < Dhuhr ≈ Noon < Asr < Maghrib < Isha
assert(t.Fajr < t.Sunrise, `Fajr(${t.Fajr}) < Sunrise(${t.Sunrise})`);
assert(t.Sunrise < t.Noon, `Sunrise(${t.Sunrise}) < Noon(${t.Noon})`);