mirror of
https://github.com/acamarata/pray-calc.git
synced 2026-06-30 19:04:26 +00:00
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:
parent
c02f197ece
commit
a8d15bc85d
1 changed files with 3 additions and 1 deletions
4
test.mjs
4
test.mjs
|
|
@ -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})`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue