testDays

reminders.testDays · #ozndd7xf · term

Days are local days: the day after the last of the month is the first of the next.

import { addDays, dayOf, dueLabel } from "#codebase/reminders";
import assert from "node:assert/strict";

export const testDays = () => {
  assert.equal(addDays("2026-10-31", 1), "2026-11-01");
  assert.equal(addDays("2026-01-01", -1), "2025-12-31");
  assert.equal(dayOf(new Date(2026, 1, 3, 23, 59)), "2026-02-03");
  assert.equal(dueLabel("2026-10-31", "2026-10-31"), "Today");
  assert.equal(dueLabel("2026-10-30", "2026-10-31"), "Yesterday");
  assert.equal(dueLabel("2026-11-03", "2026-10-31"), "Tuesday");
  assert.equal(dueLabel("2026-11-07", "2026-10-31"), "Sat 7 Nov");
}

uses