Initial commit: KOC LOOP platform
This commit is contained in:
16
tests/date-utils.test.mjs
Normal file
16
tests/date-utils.test.mjs
Normal file
@@ -0,0 +1,16 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import {
|
||||
formatShanghaiDate,
|
||||
parseStoredDate,
|
||||
} from "../lib/date-utils.ts";
|
||||
|
||||
test("treats D1 CURRENT_TIMESTAMP values as UTC and displays Beijing time", () => {
|
||||
const stored = "2026-07-29 05:36:00";
|
||||
assert.equal(parseStoredDate(stored).toISOString(), "2026-07-29T05:36:00.000Z");
|
||||
assert.match(formatShanghaiDate(stored, true), /07\/29.*13:36/);
|
||||
});
|
||||
|
||||
test("keeps date-only deadlines on the intended Shanghai calendar date", () => {
|
||||
assert.match(formatShanghaiDate("2026-08-12"), /08\/12/);
|
||||
});
|
||||
Reference in New Issue
Block a user