Simplify hafas time midnight test
This commit is contained in:
@@ -288,11 +288,7 @@ describe("hafasDateTime", () => {
|
|||||||
it('produces "00" for midnight, not "24" (k-clock safety)', () => {
|
it('produces "00" for midnight, not "24" (k-clock safety)', () => {
|
||||||
// Older ICU / Node can render midnight as "24" with hour: "numeric" + hour12: false.
|
// Older ICU / Node can render midnight as "24" with hour: "numeric" + hour12: false.
|
||||||
// We use hour: "2-digit" which guarantees "00" through "23".
|
// We use hour: "2-digit" which guarantees "00" through "23".
|
||||||
const utc = new Date(Date.UTC(2024, 0, 15, 0, 0, 0)); // Jan 15 00:00 UTC = Jan 15 01:00 CET
|
// Dec 31 23:00 UTC = Jan 1 00:00 Vienna (CET)
|
||||||
const { date: _date, time } = hafasDateTime(utc);
|
|
||||||
expect(time.startsWith("0")).toBe(true); // first digit is "0" from "01", never "24"
|
|
||||||
|
|
||||||
// Direct midnight in Vienna: Dec 31 23:00 UTC = Jan 1 00:00 CET
|
|
||||||
const midnightUtc = new Date(Date.UTC(2023, 11, 31, 23, 0, 0));
|
const midnightUtc = new Date(Date.UTC(2023, 11, 31, 23, 0, 0));
|
||||||
const { time: midnightTime } = hafasDateTime(midnightUtc);
|
const { time: midnightTime } = hafasDateTime(midnightUtc);
|
||||||
expect(midnightTime).toBe("000000000");
|
expect(midnightTime).toBe("000000000");
|
||||||
|
|||||||
Reference in New Issue
Block a user