@smartput/date
v0.2.0
Published
A calendar day, with no time inside it.
Maintainers
Readme
@smartput/date
A calendar day, with no time inside it.
datetime truncated to a day and given its own kind id, so
tomorrow is a date and tomorrow at 3pm is a datetime, and the two do not
silently unify.
Every grammar @smartput/datetime reads arrives here: first friday next
month, second monday in Aug 2027, and the calendar intervals, which land
on their first day — next week is the coming Monday, next year is
1 January.
Setup
npm add @smartput/dateExample
import { composeLocale, createEngine } from "@smartput/core";
import { english } from "@smartput/core/locale/en";
import { BUILTIN_KINDS } from "@smartput/kinds";
import BUILTIN_EN from "@smartput/kinds/locale/en";
import { datetime } from "@smartput/datetime";
import datetimeEn from "@smartput/datetime/locale/en";
import { date } from "@smartput/date";
const engine = createEngine({
locales: [composeLocale(english, [...BUILTIN_EN, datetimeEn])],
kinds: [...BUILTIN_KINDS, datetime, date],
timeZone: "Europe/Kyiv",
});
engine.evaluate("today").formatted // "2026-01-15 00:00 UTC"
engine.evaluate("next friday").formatted // "2026-01-23 00:00 UTC"
engine.evaluate("3 days ago").formatted // "2026-01-12 00:00 UTC"Entry points
| Import | Contents |
| --- | --- |
| @smartput/date | The package root. |
Runtime exports
Type-only exports are erased and do not appear here.
DATE_KIND · DATE_UNIT · DEFAULT_DATE_WEIGHT · createDate · date · startOfDay · unwrap · wrap
Dependencies
What it costs
Ceilings, not measurements. bun run check-size bundles each entry with
bun build --minify and fails if a row crosses its ceiling or drops more
than 30 % below it — a budget that is only an upper bound reports a vanished
graph as a triumph.
| Import | Minified | Gzipped | | --- | --- | --- | | date | ≤ 150 kB | ≤ 52.1 kB |
Generated by scripts/gen-readmes.ts — run bun run docs:readmes. Every
output above was produced by running the line beside it. The full page, with
live demos, is docs/packages/date.md.
