assertDateBefore
Assert that a Date holds an earlier instant than the expected one, with type-narrowing.
Comparing two instants through assertLessThan means reading epoch milliseconds out of the failure.
This reports both Dates in ISO form.
import { assertDateBefore } from "@kensio/smartass";
const createdAt: unknown = new Date("2026-01-01T00:00:00.000Z");
assertDateBefore(createdAt, new Date("2026-06-01T00:00:00.000Z"));
// createdAt is now narrowed to DateSource
Section titled “Source”Source file: src/assert/date-before/date-before.assert.ts
