@smartput/date-range
v0.2.0
Published
`last week`, `March 3–7`, `between May and June`.
Maintainers
Readme
@smartput/date-range
last week,March 3–7,between May and June.
Date endpoints plus the phrase table that resolves a named span to two
of them, and the ordinal-week grammar beside it: second week Aug 2027 is the
week that opens on that month's second Monday.
Setup
npm add @smartput/date-rangeExample
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";
import { dateRange } from "@smartput/date-range";
const engine = createEngine({
locales: [composeLocale(english, [...BUILTIN_EN, datetimeEn])],
kinds: [...BUILTIN_KINDS, datetime, date, dateRange],
timeZone: "Europe/Kyiv",
});
engine.evaluate("whole week").formatted // "2026-01-12 → 2026-01-18"
engine.evaluate("today to friday").formatted // "2026-01-15 → 2026-01-16"
engine.evaluate("next month").formatted // "2026-02-01 → 2026-02-28"
engine.evaluate("whole week + 1 wk").formatted // "2026-01-19 → 2026-01-25"Entry points
| Import | Contents |
| --- | --- |
| @smartput/date-range | The package root. |
Runtime exports
Type-only exports are erased and do not appear here.
DATE_RANGE_KIND · DATE_RANGE_UNIT · DEFAULT_PHRASE_WEIGHT · PHRASES · createDateRange · dateRange · ordinalWeekAt · phraseAt · spanFor
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-range | ≤ 154 kB | ≤ 53.3 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-range.md.
