diff --git a/ai/contributing/workflows/docs-writing.md b/ai/contributing/workflows/docs-writing.md
index 0abc0f9..a83f567 100644
--- a/ai/contributing/workflows/docs-writing.md
+++ b/ai/contributing/workflows/docs-writing.md
@@ -82,6 +82,8 @@ Use plain developer speech rather than specification jargon:
6. **Avoid tautological openings** under headings (do not follow `` ### `balance()` `` with *"`balance()` balances the duration"*).
7. **Cut filler intensifiers and clichés:** `seamlessly`, `effortlessly`, `powerful`, `first-class`, `under the hood`, `it is worth noting that`, `let's take a look at`.
8. **Do not copy terse source-comment shorthand** into user-facing prose.
+9. **Never perform or announce baseline patterns.** Do not sell standard modern practices as features (*"Import only the functions you call so your bundler tree-shakes the rest"*, *"with no extra setup call"*, *"with no registration ceremony"*). State the usage plainly and expect readers to assume baseline quality. Preserve **non-obvious, worthwhile distinctions** that genuinely change behavior or performance (such as automatic `Intl` formatter caching, zero-copy `toTemporal()` unwrapping, or skipping polyfill downloads on native runtimes).
+10. **Give each example one canonical home.** Avoid repeating multi-line setup blocks (polyfilling, plugin imports, `configure()` tables) across multiple guides—keep the full walkthrough in one page and link to it from related guides so updates and translations do not multiply.
---
@@ -111,6 +113,22 @@ Ask whether changing time zones should change what the user sees.
:::
```
+## Collapsible Disclosures (`:::details[Title]`)
+
+Use `:::details[Title]` ... `:::` (pass `{open}` only when expanded by default) to fold secondary material that is not necessary on a first read, keeping the happy path short and scannable while leaving deep-dive details one click away:
+
+- **Collapse:** long mid-guide reference tables (such as a full token dictionary or legacy preset aliases), niche escape-hatch options (such as DST `disambiguation` modes), and older-toolchain compatibility notes (`/sync` polyfill loading, older Node caveats).
+- **Keep open:** Day-1 requirements that most readers need immediately (such as the primary Safari polyfill command on `Installation`) and primary reference tables on migration guides (`Coming from Day.js`, `Coming from Moment`).
+- **Keep titles plain and code narrow:** Use a short sentence-case title with no backticks. Wrap long lines in code blocks inside `:::details` so they fit inside the padded body without horizontal scrollbars. A single table inside `:::details` renders flush without a double border.
+
+```markdown
+:::details[Compatibility notes for older runtimes]
+- **Synchronous loading:** Import `@native-dates/polyfill/sync` if a module evaluates dates before top-level `await` settles.
+:::
+```
+
+When two commands or snippets represent **mutually exclusive choices** (such as `npm i` vs. `npx` agent setup), group consecutive fenced blocks with `label="..."` into a single tabbed code block instead of stacking them under separate headings that read like sequential steps.
+
---
## Astro Markdown and Layout Constraints (`docs/`)
@@ -124,7 +142,7 @@ Ask whether changing time zones should change what the user sees.
4. **Headings and tables:**
- Never put backticks in `##` headings or `
` cells (`docs.css` strips code-chip backgrounds only inside `h1` and `.entry > h3`).
- In 3+ column tables (`.stacks`), the final column **must** be prose because narrow screens (`<= 600px`) render the last cell full-width without a column label. Separate grouped identifiers in earlier columns with commas (`year, month, day`).
- - Use `:::truth` around 2-column expression/result tables where `true` and `false` cells render as tinted status words.
+ - Use `:::truth` around 2-column expression/result tables where `true` and `false` cells render as tinted status words, `:::details[Title]` for collapsible deep-dive blocks, and consecutive `label="..."` code fences for tabbed alternatives.
5. **Inline formatting limits:** Keep inline `` `code` `` spans under ~32 characters (`white-space: nowrap` overflows on `390px` mobile viewports) and avoid attaching suffixes directly onto closing backticks (write `` `DateTime` instances `` rather than `` `DateTime`s ``). In frontmatter `lede` and YAML `description` strings, `inline.js` parses only `` `code` ``, `**strong**`, and `[text](href)` (never `*italic*`).
6. **Verify before finishing:**
- Execute standalone `js` code samples in Node against `src/index.js` and `packages/plugins/src/*.js`.
diff --git a/docs/src/content/docs/guides/customization.md b/docs/src/content/docs/guides/customization.md
index 1c35c8d..418ba89 100644
--- a/docs/src/content/docs/guides/customization.md
+++ b/docs/src/content/docs/guides/customization.md
@@ -48,7 +48,7 @@ const placed = datetime('2026-11-06T09:05', 'Europe/Berlin');
placed.format('receipt'); // 'Friday, November 6'
```
-Named formats work on every type that supports [`format()`](/guides/formatting/), and custom names take precedence over built-in presets.
+Named formats apply to dates, times, partial dates, and ranges, while durations use only their built-in styles. Custom names take precedence over built-in presets, so registering `'short'` overrides it across the app.
## Adding plugins
diff --git a/docs/src/content/docs/guides/durations.md b/docs/src/content/docs/guides/durations.md
index 6ba0f85..e6b9ed7 100644
--- a/docs/src/content/docs/guides/durations.md
+++ b/docs/src/content/docs/guides/durations.md
@@ -78,7 +78,7 @@ Without an argument, standalone durations carry months into years and clock unit
Pass `'day'` or `'week'` when you want fixed 24-hour days or 7-day weeks.
-Call [`total()`](/api/duration/#total) or its chain-friendly alias [`as()`](/api/duration/#as) to collapse the entire span into a single floating-point number in one unit:
+Call [`total()`](/api/duration/#total) or its alias [`as()`](/api/duration/#as) to collapse the entire span into a single floating-point number in one unit:
```js
import { duration } from 'native-dates';
diff --git a/docs/src/content/docs/guides/formatting.md b/docs/src/content/docs/guides/formatting.md
index 747b90f..e0f9952 100644
--- a/docs/src/content/docs/guides/formatting.md
+++ b/docs/src/content/docs/guides/formatting.md
@@ -8,7 +8,7 @@ Native Dates uses the platform's built-in `Intl` formatters and caches them auto
## Quick output with text and presets
-Every instance has a `.text` property formatted in your active locale, which is handy for templates, logs, and console debugging. Calling [`format()`](/api/date-time/#format) with no arguments uses each type's default preset:
+Every instance has a `.text` property formatted in your active locale. Calling [`format()`](/api/date-time/#format) with no arguments uses each type's default preset:
```js
import { date, datetime, duration, time } from 'native-dates';
@@ -35,6 +35,7 @@ Pass a preset name to `format()` to choose how much detail to display:
| `'month'` | `'May 2026'` | Full month name and year on `DateTime`, `CalendarDate`, and [`YearMonth`](/api/year-month/). |
| `'text'` | `'May 4, 2026, 9:30 AM PDT'` | Date, time, and short zone name on `DateTime`, or each type's own fields elsewhere. |
+:::details[Moment and Day.js preset names]
Core also accepts the localized preset names used in Moment and Day.js:
| Preset | Example | Localized fields |
@@ -44,6 +45,7 @@ Core also accepts the localized preset names used in Moment and Day.js:
| `'LL'`, `'ll'` | `'May 4, 2026'` | Long or abbreviated month name with day and year. |
| `'LLL'`, `'lll'` | `'May 4, 2026 at 9:30 AM'` | Long or abbreviated date paired with short clock time. |
| `'LLLL'`, `'llll'` | `'Monday, May 4, 2026 at 9:30 AM'` | Full or abbreviated weekday, date, and short clock time. |
+:::
Dates, times, [year-months](/api/year-month/), and [month-days](/api/month-day/) accept every preset above and keep only the fields they carry. [Durations](/api/duration/) also support compact and digital styles:
@@ -102,7 +104,7 @@ Reserve `format()` for text shown to people. When storing values or sending them
## Token patterns
-When you need a fixed layout, pass a token pattern directly to `format()` with no plugins required. Wrap literal words in square brackets so they are copied as written:
+When you need a fixed layout, pass a token pattern to `format()`. Wrap literal words in square brackets so they are copied as written:
```js
import { datetime, monthDay, yearMonth } from 'native-dates';
@@ -118,6 +120,7 @@ monthDay('11-16').format('MMMM Do', 'en-US'); // 'November 16th'
Month and weekday names inside token patterns come from `Intl` in the active locale. Digits and years stay in Western ISO form so patterns like `'YYYY-MM-DD'` stay machine-readable everywhere.
+:::details[All format tokens]
| Token | Example | Output |
|---|---|---|
| `YYYY` | `'2026'` | Four-digit year, signed for negative years. |
@@ -144,8 +147,9 @@ Month and weekday names inside token patterns come from `Intl` in the active loc
| `X` | `'1794850200'` | Unix timestamp in whole seconds. |
| `x` | `'1794850200000'` | Unix timestamp in milliseconds. |
| `[text]` | `'[at]'` | Escaped literal text copied straight to the output. |
+:::
-Unrecognized letters outside square brackets throw an [`unknownFormat`](/api/errors/#units-zones-and-formats) error so a misspelled preset or unbracketed word fails right away instead of printing raw letters. Tokens glued to accented letters like `'às'` or mixed clock letters like `'HHhmm'` throw too, while bare T passes through unescaped for ISO timestamps.
+Unrecognized letters outside square brackets throw an [`unknownFormat`](/api/errors/#units-zones-and-formats) error instead of printing raw letters. Tokens glued to accented letters like `'às'` or mixed clock letters like `'HHhmm'` throw too. Bare `T` passes through unescaped for ISO timestamps.
Asking for a field a type does not carry throws an [`unsupportedToken`](/api/errors/#units-zones-and-formats) error instead of inventing midnight. Formatting clock tokens like `'HH:mm'` on a calendar date fails immediately.
@@ -161,26 +165,7 @@ weekdayNames('narrow', 'monday', 'en-US'); // ['Mo', 'Tu', 'We', ...]
## Naming your own formats
-Register reusable format names in [`configure()`](/api/configure/) when your app uses the same date or time layout in multiple places. Each named format can be a token pattern or an `Intl` options object:
-
-```js
-import { configure, date, dateRange } from 'native-dates';
-
-configure({
- formats: {
- invoice: 'YYYY-MM-DD',
- receipt: { dateStyle: 'long' },
- },
-});
-
-date('2026-11-06').format('invoice'); // '2026-11-06'
-date('2026-11-06').format('receipt'); // 'November 6, 2026'
-dateRange('2026-11-06', '2026-11-20').format('invoice'); // '2026-11-06 – 2026-11-20'
-
-configure({ formats: null });
-```
-
-Named formats take precedence over built-in presets, so registering `'short'` overrides that preset across the app. Custom named formats apply to dates, times, partial dates, and ranges, while durations use only their built-in styles.
+Register reusable format names in [`configure()`](/api/configure/) when your app reuses a token pattern or `Intl` options object across views. Custom names work on dates, times, partial dates, and ranges, and take precedence over built-in presets. See [Named formats](/guides/customization/#named-formats).
## Formatting ranges
@@ -199,7 +184,7 @@ shift.format('short', 'en-US'); // '9:00 AM – 5:00 PM'
## Relative phrases
-Moments and calendar dates include [`from()`](/api/date-time/#from) and [`fromNow()`](/api/date-time/#fromnow) directly in core, with [`formatRelative()`](/api/date-time/#formatrelative) as an alias. Phrases are localized automatically through the runtime's relative time formatter:
+Call [`from()`](/api/date-time/#from) or [`fromNow()`](/api/date-time/#fromnow) on moments and calendar dates for localized phrases through the runtime's relative time formatter. [`formatRelative()`](/api/date-time/#formatrelative) works as an alias:
```js
import { date, datetime, now, today } from 'native-dates';
diff --git a/docs/src/content/docs/guides/from-dayjs.md b/docs/src/content/docs/guides/from-dayjs.md
index 434ca05..0ec9ed1 100644
--- a/docs/src/content/docs/guides/from-dayjs.md
+++ b/docs/src/content/docs/guides/from-dayjs.md
@@ -82,7 +82,7 @@ dt.format('YYYY-MM-DD HH:mm'); // '2026-11-16 12:30'
## Opt-in plugins
-Only non-ISO text parsing, city and abbreviation lookups, and legacy date getters live in [`@native-dates/plugins`](/plugins/). Import each subpath once with no global registration call needed:
+Only non-ISO text parsing, city and abbreviation lookups, and legacy date getters live in [`@native-dates/plugins`](/plugins/). Import each subpath once at startup:
```js
import '@native-dates/plugins/loose';
@@ -102,13 +102,13 @@ date('Nov 16, 2026', { loose: true }); // CalendarDate(2026-11-16)
| `d.day()`, `d.isoWeekday()` | `d.dayOfWeek` | ISO 1 on Monday to 7 on Sunday, with tokens `'E'` for 1–7 and `'d'` for 0–6 |
| `d.unix()`, `d.valueOf()` | `dt.epochSeconds`, `dt.epochMilliseconds` | Each count since 1970 names its unit |
| `d.add(2, 'day')` | `d.plus(2, 'days')` | `add()` and `subtract()` aliases also work |
-| `dayjs.tz(x, zone)` | `datetime(x, zone)` | Built into core with no `timezone` plugin |
+| `dayjs.tz(x, zone)` | `datetime(x, zone)` | In core, no `timezone` plugin |
| `d.tz(zone)` | `dt.in(zone)` | Views the same moment in another IANA zone |
-| `dayjs.utc(x)` | `datetime(x, 'UTC')` | Built into core with no `utc` plugin |
+| `dayjs.utc(x)` | `datetime(x, 'UTC')` | In core, no `utc` plugin |
| `b.diff(a, 'day', true)` | `a.until(b, 'days')` | Fractional total in the requested unit |
-| `dayjs.duration(90, 'm')` | `minutes(90)` or `duration('90m')` | Built into core with no `duration` plugin |
-| `d.format('LLL')` | `dt.format('LLL')` | Localized presets from `'LT'` to `'llll'` in core |
-| `d.format('YYYY-MM-DD HH:mm')` | `dt.format('YYYY-MM-DD HH:mm')` | [Token patterns](/guides/formatting/#token-patterns) built directly into core |
-| `d.isBetween(a, b)` | `dateRange(a, b).contains(d)` | [Ranges](/api/ranges/) built into core with `to()`, `for()`, and `overlaps()` |
-| `d.fromNow()`, `d.from(other)` | `d.fromNow()`, `d.from(other)` | Built into core with no `relativeTime` plugin |
+| `dayjs.duration(90, 'm')` | `minutes(90)` or `duration('90m')` | In core, no `duration` plugin |
+| `d.format('LLL')` | `dt.format('LLL')` | Localized presets from `'LT'` to `'llll'` |
+| `d.format('YYYY-MM-DD HH:mm')` | `dt.format('YYYY-MM-DD HH:mm')` | [Token patterns](/guides/formatting/#token-patterns) in core |
+| `d.isBetween(a, b)` | `dateRange(a, b).contains(d)` | [Ranges](/api/ranges/) with `to()`, `for()`, and `overlaps()` |
+| `d.fromNow()`, `d.from(other)` | `d.fromNow()`, `d.from(other)` | In core, no `relativeTime` plugin |
| `customParseFormat` | `{ loose: true }` | Provided by [`@native-dates/plugins/loose`](/plugins/loose/) |
diff --git a/docs/src/content/docs/guides/from-moment.md b/docs/src/content/docs/guides/from-moment.md
index cc69a44..f1c3dee 100644
--- a/docs/src/content/docs/guides/from-moment.md
+++ b/docs/src/content/docs/guides/from-moment.md
@@ -91,16 +91,16 @@ quarter.overlaps(dateRange('2026-12-15', '2027-01-15')); // true
| `m.day()`, `m.isoWeekday()` | `d.dayOfWeek` | ISO 1 on Monday to 7 on Sunday, with tokens `'E'` for 1–7 and `'d'` for 0–6 |
| `m.unix()`, `m.valueOf()` | `dt.epochSeconds`, `dt.epochMilliseconds` | Each count since 1970 names its unit |
| `b.diff(a, 'hours', true)` | `a.until(b, 'hours')` | Fractional total in the requested unit |
-| `moment.duration(2, 'h')` | `hours(2)` or `duration('2h')` | Built into core |
-| `m.format('LLL')` | `dt.format('LLL')` | Localized presets from `'LT'` to `'llll'` with zero locale files |
-| `m.format('YYYY-MM-DD HH:mm')` | `dt.format('YYYY-MM-DD HH:mm')` | [Token patterns](/guides/formatting/#token-patterns) built directly into core |
-| `m.isBetween(a, b)` | `dateRange(a, b).contains(d)` | [Ranges](/api/ranges/) built into core with `to()`, `for()`, and `overlaps()` |
-| `m.fromNow()`, `m.from(other)` | `dt.fromNow()`, `dt.from(other)` | [Relative phrases](/guides/formatting/#relative-phrases) built into core |
+| `moment.duration(2, 'h')` | `hours(2)` or `duration('2h')` | Duration helpers in core |
+| `m.format('LLL')` | `dt.format('LLL')` | Localized presets from `'LT'` to `'llll'` without locale files |
+| `m.format('YYYY-MM-DD HH:mm')` | `dt.format('YYYY-MM-DD HH:mm')` | [Token patterns](/guides/formatting/#token-patterns) |
+| `m.isBetween(a, b)` | `dateRange(a, b).contains(d)` | [Ranges](/api/ranges/) with `to()`, `for()`, and `overlaps()` |
+| `m.fromNow()`, `m.from(other)` | `dt.fromNow()`, `dt.from(other)` | [Relative phrases](/guides/formatting/#relative-phrases) |
| Non-ISO string parsing | `{ loose: true }` | Load [`@native-dates/plugins/loose`](/plugins/loose/) for locale-aware and informal string parsing |
## Migrating incrementally
-Large codebases rarely convert in a single pull request. Call [`toJSDate()`](/api/date-time/#tojsdate) at boundaries that still expect a native JavaScript date, and pass dates straight back into [`datetime()`](/api/datetime-fn/) on the way in.
+Large codebases rarely convert in a single pull request. Call [`toJSDate()`](/api/date-time/#tojsdate) at boundaries that still expect a native JavaScript date, and pass dates back into [`datetime()`](/api/datetime-fn/) on the way in.
```js
import { datetime } from 'native-dates';
diff --git a/docs/src/content/docs/guides/localization.md b/docs/src/content/docs/guides/localization.md
index 35d049c..465414f 100644
--- a/docs/src/content/docs/guides/localization.md
+++ b/docs/src/content/docs/guides/localization.md
@@ -1,23 +1,23 @@
---
title: Localization
lede: Choose between the browser's default locale, a one-time app setting, a locale carried on a value, or a single-call override.
-updated: 2026-11-22
+updated: 2026-11-23
---
-Native Dates formats through the JavaScript engine's built-in `Intl` data. Every language, script, plural rule, and calendar system works out of the box with zero locale files to download.
+Native Dates formats through the JavaScript engine's built-in `Intl` data. Every language, script, plural rule, and calendar system works without downloading locale files.
Where you set the locale depends on your runtime. Choose the scope that matches how your app runs:
-- **Runtime default** when a browser app follows the reader's system settings with zero setup
+- **Runtime default** when a browser app follows the reader's system settings
- **App-wide [`configure()`](/api/configure/)** when a client app has its own language switcher or fixed locale
- **Value-level [`locale()`](/api/date-time/#locale)** when a server formats per request or a chain carries its own language
- **One-off [`format()`](/api/date-time/#format)** when a single label needs another calendar or regional dialect
## Zero setup in the browser
-When you set nothing, every `.text` property, `format()` call, range, duration, and name helper uses the runtime's active locale.
+When no locale is configured or passed, every `.text` property, `format()` call, range, duration, and name helper uses the runtime's active locale.
-Single-user browser apps that follow the reader's system language need no setup at all:
+Single-user browser apps that follow the reader's system language need no setup:
```js
import { dateRange, hours, today } from 'native-dates';
@@ -31,7 +31,7 @@ hours(2).format('long');
Call [`configure()`](/api/configure/) once at startup when your app has its own language picker or targets a fixed locale. Update it again whenever the reader switches languages.
-Every value, range, duration, partial date, and name helper formats in that locale automatically:
+Every value, range, duration, partial date, and name helper formats in that locale:
```js title="main.js"
import { configure, date, days, monthNames, yearMonth } from 'native-dates';
@@ -82,7 +82,11 @@ function formatOrder(order, user) {
formatOrder({ placedAt: '2026-05-15T14:30:00Z' }, { zone: 'Asia/Tokyo', locale: 'ja-JP' });
```
-Calling `locale()` with no arguments reads back the active tag, or returns `undefined` when none was set. Passing an empty value clears it so `locale(user.locale)` chains cleanly even on an empty database column.
+:::warning[Avoid per-request configure on servers]
+Global configuration updates shared state across the entire JavaScript process. On a multi-user server, another request can overwrite a `configure()` call across an async boundary. Attach `locale()` to the value instead.
+:::
+
+Calling `locale()` with no arguments reads back the active tag, or returns `undefined` when none was set. Passing an empty value clears it so `locale(user.locale)` chains safely even on an empty database column.
Raw locale strings and HTTP Accept-Language headers work directly without preprocessing. Underscore tags like `'en_US'` normalize automatically, and header tags sort by quality weight while dropping zero-weighted entries. Invalid locale strings throw [`unknownLocale`](/api/errors/#units-zones-and-formats):
@@ -91,10 +95,6 @@ datetime('2026-05-15T14:30:00Z').locale('en_US').locale(); // 'en-US'
datetime('2026-05-15T14:30:00Z').locale('fr-CH;q=0.8, de;q=0.9, es;q=0').locale(); // ['de', 'fr-CH']
```
-:::warning[Avoid per-request configure on servers]
-Global configuration updates shared state across the entire JavaScript process. On a multi-user server, another request can overwrite a `configure()` call across an async boundary. Attach `locale()` to the value instead.
-:::
-
An instance locale controls localized text, week boundaries, and weekend days. Exact comparisons, sorting, [`equals()`](/api/date-time/#equals), and ISO serialization with [`toString()`](/api/date-time/#tostring) ignore it:
```js
@@ -110,7 +110,33 @@ french.to(japanese).locale(); // 'fr'
When a method combines two values with different locales, the value the method was called on keeps its own locale.
-## First day of the week
+## One-off calendar and dialect overrides
+
+Pass a BCP 47 tag to `format()` when a single label needs another calendar, numbering system, or dialect. The value itself keeps its existing locale:
+
+```js
+import { date } from 'native-dates';
+
+const reiwa = date('2019-05-01').locale('ja-JP');
+reiwa.format('long'); // '2019年5月1日'
+reiwa.format('long', 'ja-u-ca-japanese'); // '令和元年5月1日'
+
+const eid = date('2026-03-20').locale('ar-SA');
+eid.format('long', 'ar-SA-u-ca-islamic-umalqura'); // '١ شوال ١٤٤٧ هـ'
+```
+
+## How locales resolve
+
+When formatting any value, range, duration, or relative phrase, Native Dates checks each source in order and uses the first locale it finds:
+
+| Priority | Source | Use when |
+|---|---|---|
+| 1 | `value.format(spec, locale)` | One call needs another calendar, script, or regional dialect. |
+| 2 | `value.locale(tag)` or `{ locale }` | Server requests, reusable chains, or localized UI sections. |
+| 3 | `configure({ locale })` | Client apps have a global language setting or switcher. |
+| 4 | Runtime `Intl` default | Browser apps follow the reader's system language. |
+
+## Weeks and weekends
Week boundaries and weekday headers follow the active locale automatically. The runtime reports Sunday in the United States, Japan, Korea, and Brazil, Saturday in Egypt, and Monday across most of Europe and China.
@@ -131,9 +157,8 @@ weekdayNames('short', undefined, 'de-DE')[0]; // 'Mo'
Pass an explicit weekday to override one call, or set `weekStart` in [`configure()`](/api/configure/) to pin a start day across every locale. Passing an empty value returns to following the locale, and runtimes without week data fall back to Monday.
-An instance keeps the locale of the value it was derived from. Pin `weekStart` or pass a day whenever weeks key stored data like reports or billing periods.
-
-Every date and datetime reports the day its own weeks start on as `weekStart`, from 1 for Monday through 7 for Sunday. Check it where code depends on a specific start of week:
+:::details[Guarding fixed-week reports]
+An instance keeps the locale of the value it was derived from. Pin `weekStart` or check `day.weekStart`, from 1 for Monday through 7 for Sunday, whenever weeks key stored data like reports or billing periods:
```js title="reports.js"
function weekKey(day) {
@@ -145,6 +170,7 @@ function weekKey(day) {
```
ISO week numbers from `weekOfYear` always count weeks from Monday, and `dayOfWeek` follows the same Monday-first numbering.
+:::
Weekend checks follow the active locale too. [`isWeekend()`](/api/calendar-date/#calendar-predicates) and [`isWeekday()`](/api/calendar-date/#calendar-predicates) treat Friday and Saturday as the weekend in Saudi Arabia and Egypt, and Friday alone in Iran. India uses Sunday alone, while most other locales use Saturday and Sunday:
@@ -155,62 +181,12 @@ friday.locale('en-US').isWeekend(); // false
friday.locale('ar-SA').isWeekend(); // true
```
-## One-off calendar and dialect overrides
-
-Pass a BCP 47 tag to `format()` when a single label needs another calendar, numbering system, or dialect. The value itself keeps its existing locale:
-
-```js
-import { date } from 'native-dates';
+## Custom weekday names and ordinals
-const reiwa = date('2019-05-01').locale('ja-JP');
-reiwa.format('long'); // '2019年5月1日'
-reiwa.format('long', 'ja-u-ca-japanese'); // '令和元年5月1日'
-
-const eid = date('2026-03-20').locale('ar-SA');
-eid.format('long', 'ar-SA-u-ca-islamic-umalqura'); // '١ شوال ١٤٤٧ هـ'
-```
+Month and weekday names come from the runtime, matching what the reader's device prints. Two format tokens have no standard platform field: two-letter weekdays with `dd`, and day ordinals with `Do`.
-## Writing weekdays and ordinals your own way
+By default, `dd` truncates the short weekday to two letters where scripts abbreviate that way, and otherwise uses the runtime's narrow weekday. `Do` formats English ordinal suffixes in English and the locale's day marker elsewhere, such as `'6.'` in German.
-Month and weekday names come from the runtime, matching what the reader's own device prints. Two format tokens have no standard platform field: two-letter weekdays with `dd`, and day ordinals with `Do`.
-
-By default, `dd` truncates the short weekday to two letters in scripts that abbreviate that way, and otherwise uses the runtime's narrow weekday. `Do` formats English ordinal suffixes in English and the locale's day marker elsewhere, such as '6.' in German.
-
-Override either in [`configure()`](/api/configure/) once at startup. Key weekday tables by language, width, and day name so you can adjust individual days without listing all seven:
-
-```js
-import { configure, date } from 'native-dates';
-
-configure({
- weekdayNames: {
- lv: { narrow: { fri: 'Pk', sun: 'Sv' } },
- en: { short: { tue: 'Tues', thu: 'Thurs' } },
- },
- ordinals: {
- fr: (day) => (day === 1 ? '1er' : day),
- },
-});
-
-date('2026-11-01').format('Do MMMM', 'fr'); // '1er novembre'
-date('2026-11-01').format('dd', 'lv'); // 'Sv'
-date('2026-11-03').format('ddd', 'en-US'); // 'Tues'
-
-configure({ weekdayNames: null, ordinals: null });
-```
-
-Widths match [weekday names](/api/month-names/#weekdaynames), mapping narrow, short, and long styles to `dd`, `ddd`, and `dddd` tokens.
-
-Regional tags like `'fr-CA'` inherit their base language's entry and layer any overrides of their own on top, matching in any letter case. Presets and `Intl` options objects come straight from the runtime and are unaffected.
-
-## How locales resolve
-
-When formatting any value, range, duration, or relative phrase, Native Dates checks each source in order and uses the first locale it finds:
-
-| Priority | Source | When to reach for it |
-|---|---|---|
-| 1 | `value.format(spec, locale)` | One call in another calendar, script, or regional dialect. |
-| 2 | `value.locale(tag)` or `{ locale }` | Server requests, reusable chains, or localized UI sections. |
-| 3 | `configure({ locale })` | Client apps with a global language setting or switcher. |
-| 4 | Runtime `Intl` default | Browser apps following the reader's system language. |
+Override either globally through `weekdayNames` and `ordinals` in [`configure()`](/api/configure/). Regional tags like `'fr-CA'` inherit their base language's entries and layer overrides on top, while presets and `Intl` options remain untouched. See [Customization](/guides/customization/#custom-weekday-names-and-ordinals) for examples.
Browse the [language examples](/examples/#localization) and the per-language guides under **Handling time in** in the sidebar for regional, script, and calendar edge cases. Next, read [Types of time](/guides/types-of-time/) to pick the right type for each value in your app.
diff --git a/docs/src/content/docs/guides/overview.md b/docs/src/content/docs/guides/overview.md
index e68ebc4..b428977 100644
--- a/docs/src/content/docs/guides/overview.md
+++ b/docs/src/content/docs/guides/overview.md
@@ -15,7 +15,7 @@ const standup = date('2026-11-16')
.in('Europe/Berlin');
```
-Because the runtime already carries the IANA time-zone database and locale rules, every region and language works out of the box. Your bundle never downloads extra zone or locale tables.
+Because the runtime already carries the IANA time-zone database and locale rules, every region and language works without shipping extra zone or locale tables.
## Separate types for separate jobs
@@ -74,19 +74,10 @@ time('9:30am').text; // '9:30 AM'
Because methods return new instances, `===` checks object references rather than value equality. Call [`equals()`](/api/date-time/#equals) to check whether two instances represent the same date, time, or moment.
:::
-## Lean core and opt-in plugins
+## Core and plugins
-The core [`native-dates`](/guides/installation/) package stays small. It covers creation, time zones, calendar math, partial dates, ranges, durations, relative phrases, localized presets, and token patterns.
+The core [`native-dates`](/guides/installation/) package covers creation, time zones, calendar math, partial dates, ranges, durations, relative phrases, localized presets, and token patterns.
-Optional additions like city and abbreviation lookups, loose parsing, and legacy `Date` methods live in [`@native-dates/plugins`](/plugins/) as individual subpath imports:
-
-```js
-import '@native-dates/plugins/loose';
-import '@native-dates/plugins/zones';
-import { date, datetime } from 'native-dates';
-
-datetime('2026-11-16T09:30', 'Berlin').zone; // 'Europe/Berlin'
-date('Nov 16, 2026', { loose: true }); // CalendarDate(2026-11-16)
-```
+Optional plugins for city and abbreviation lookups, loose parsing, and legacy `Date` methods live in [`@native-dates/plugins`](/plugins/) as individual subpath imports. See [Customization](/guides/customization/#adding-plugins) to add plugins or configure app-wide defaults.
Head to [Installation](/guides/installation/) to add the package to your project and set up polyfilling if you support Safari.
diff --git a/docs/src/content/docs/guides/parsing.md b/docs/src/content/docs/guides/parsing.md
index 185a235..c089a81 100644
--- a/docs/src/content/docs/guides/parsing.md
+++ b/docs/src/content/docs/guides/parsing.md
@@ -139,7 +139,7 @@ yearMonth('Nov 2026', { loose: true }); // 2026-11
monthDay('17 février', { loose: true, locale: 'fr' }); // 02-17
```
-Numeric slash and dot dates follow the active locale's order automatically. Pass `dayFirst` per call or set it in [app configuration](/api/configure/) when an input uses a different order than the active locale.
+Numeric slash and dot dates follow the active locale's order. Pass `dayFirst` per call or set it in [app configuration](/api/configure/) when an input uses a different order than the active locale.
```js
date('03/05/2026', { loose: true, locale: 'en-US' }); // 2026-03-05
@@ -147,7 +147,7 @@ date('03/05/2026', { loose: true, locale: 'fr' }); // 2026-05-03
date('03/05/2026', { loose: true, locale: 'en-US', dayFirst: true }); // 2026-05-03
```
-Under loose parsing, unreadable inputs return `null` instead of throwing across every factory and range, keeping form validation to a simple check. Invalid option values like an unknown time zone name still throw immediately.
+Under loose parsing, unreadable inputs return `null` instead of throwing across every factory and range. Invalid option values like an unknown time zone name still throw.
```js
import { duration } from 'native-dates';
diff --git a/docs/src/content/docs/guides/ranges.md b/docs/src/content/docs/guides/ranges.md
index 1238cd3..e890f7b 100644
--- a/docs/src/content/docs/guides/ranges.md
+++ b/docs/src/content/docs/guides/ranges.md
@@ -66,7 +66,7 @@ booking.overlaps(holiday); // true
booking.intersection(holiday).toString(); // '2026-11-15/2026-11-18'
```
-`intersection()` returns `null` when two ranges do not overlap. That makes it easy to branch on availability or scheduling conflicts.
+`intersection()` returns `null` when two ranges do not overlap.
## Walking, counting, and splitting spans
@@ -97,7 +97,7 @@ slots[0].toString(); // '09:00:00/09:30:00'
## Formatting and serializing
-Formatting a range with a preset collapses shared months and years automatically through the runtime's locale rules. Pass a token pattern to format both endpoints explicitly:
+Formatting a range with a preset collapses shared months and years through the runtime's locale rules. Pass a token pattern to format both endpoints explicitly:
```js
import { dateRange, timeRange } from 'native-dates';
diff --git a/docs/src/content/docs/guides/temporal.md b/docs/src/content/docs/guides/temporal.md
index 4be444d..eee2059 100644
--- a/docs/src/content/docs/guides/temporal.md
+++ b/docs/src/content/docs/guides/temporal.md
@@ -4,7 +4,7 @@ lede: How Native Dates maps onto JavaScript's Temporal API and interops with raw
updated: 2026-11-23
---
-Native Dates is a thin, ergonomic layer over JavaScript's built-in `Temporal` and Intl APIs.
+Native Dates wraps JavaScript's built-in `Temporal` and `Intl` APIs.
Temporal provides exact calendar and time-zone primitives with explicit options objects. Native Dates wraps everyday callsites in concise methods while interoperating freely with raw Temporal instances.
@@ -25,7 +25,7 @@ Temporal leaves ranges out of its specification. Core adds [`DateRange`, `DateTi
## Passing Temporal objects in
-Every factory, arithmetic method, and comparison accepts raw `Temporal` values directly without manual conversion steps.
+Every factory, arithmetic method, and comparison accepts raw `Temporal` values directly.
```js
import { date, datetime, time, yearMonth } from 'native-dates';
@@ -45,7 +45,7 @@ ym.daysInMonth; // 30
Passing a `Temporal.ZonedDateTime` to [`datetime()`](/api/datetime-fn/) preserves its time zone unless you pass a new one. Passing an instant or plain date-time places that value into the zone you specify or your configured default.
-Temporal values and strings using non-ISO calendars like Japanese or Persian convert to the same ISO day automatically without calling `withCalendar()` first.
+Temporal values and strings using non-ISO calendars like Japanese or Persian convert to the same ISO day without calling `withCalendar()` first.
Comparisons and span measurements accept Temporal inputs directly too:
@@ -77,21 +77,6 @@ Each instance holds a real Temporal object internally, so `toTemporal()` returns
## Polyfilling older runtimes
-Current Chrome, Edge, Firefox, Node 26+, Deno, and Bun ship `Temporal` natively, so core includes zero polyfill code in its bundle.
+Current Chrome, Edge, Firefox, Node 26+, Deno, and Bun ship `Temporal` natively, so core includes zero polyfill code.
-Safari, older browsers, and Node 24–25 need `@native-dates/polyfill` alongside `temporal-polyfill`. Server code calling [`Duration.format()`](/api/duration/#format) requires Node 24+ because older Node releases lack `Intl.DurationFormat`:
-
-```sh
-npm install @native-dates/polyfill temporal-polyfill
-```
-
-Import `@native-dates/polyfill` once at your application entry point before importing from Native Dates:
-
-```js
-import '@native-dates/polyfill';
-import { today } from 'native-dates';
-
-today().plus(1, 'week');
-```
-
-The default entry checks `globalThis.Temporal` first and dynamically imports the polyfill only when needed, so modern browsers skip downloading it. Import `'@native-dates/polyfill/sync'` instead if another module evaluates dates at load time, such as `export const start = today()`, or if your environment lacks top-level await.
+For Safari, older browsers, or Node 24–25, load `@native-dates/polyfill` alongside `temporal-polyfill` at startup. See [Supporting Safari and older Node](/guides/installation/#supporting-safari-and-older-node) for setup and synchronous loading options.
diff --git a/docs/src/content/docs/guides/time-zones.md b/docs/src/content/docs/guides/time-zones.md
index a046544..d5b0b4a 100644
--- a/docs/src/content/docs/guides/time-zones.md
+++ b/docs/src/content/docs/guides/time-zones.md
@@ -88,7 +88,7 @@ saturday.plus(1, 'day').hoursInDay; // 23
```
:::warning[Times skipped by spring-forward]
-When clocks jump from 2:00 AM to 3:00 AM, local times like 2:30 AM never happen in that zone. Asking for a skipped local time moves forward cleanly by the length of the gap instead of throwing.
+When clocks jump from 2:00 AM to 3:00 AM, local times like 2:30 AM never happen in that zone. Asking for a skipped local time moves forward by the length of the gap instead of throwing.
:::
```js
@@ -96,12 +96,22 @@ const skipped = datetime('2026-03-08T02:30', 'America/New_York');
skipped.text; // 'Mar 8, 2026, 3:30 AM EDT'
```
-When scheduling or auditing requires a different rule across spring-forward gaps or fall-back folds, pass `disambiguation` (`'compatible'`, `'earlier'`, `'later'`, or `'reject'`) to [`datetime()`](/api/datetime-fn/), `date.at()`, `dt.at()`, or `time.on()`:
+:::details[Controlling spring-forward gaps and fall-back folds]
+Pass `disambiguation` to [`datetime()`](/api/datetime-fn/) or `at()` when scheduling or auditing needs a different rule across gaps and folds. It defaults to compatible and also accepts earlier, later, or reject:
```js
-datetime('2026-11-01T01:30', { zone: 'America/New_York', disambiguation: 'later' }).offset; // '-05:00'
-datetime('2026-03-08T02:30', { zone: 'America/New_York', disambiguation: 'reject' }); // throws RangeError [invalidDateTime]
+const fallBack = datetime('2026-11-01T01:30', {
+ zone: 'America/New_York',
+ disambiguation: 'later',
+});
+fallBack.offset; // '-05:00'
+
+datetime('2026-03-08T02:30', {
+ zone: 'America/New_York',
+ disambiguation: 'reject',
+}); // throws RangeError [invalidDateTime]
```
+:::
## City names and abbreviations
diff --git a/docs/src/content/docs/guides/writing-a-plugin.md b/docs/src/content/docs/guides/writing-a-plugin.md
index 6a1fb5e..6e16d96 100644
--- a/docs/src/content/docs/guides/writing-a-plugin.md
+++ b/docs/src/content/docs/guides/writing-a-plugin.md
@@ -4,7 +4,7 @@ lede: Extend Native Dates with opt-in prototype methods and TypeScript module au
updated: 2026-11-12
---
-Plugins install by importing a module, with no registration ceremony or wrapper calls.
+Plugins activate when imported.
You can publish reusable packages or add domain helpers inside your own app using the same pattern as [`zones`](/plugins/zones/) and [`legacy-date`](/plugins/legacy-date/) in [`@native-dates/plugins`](/plugins/).
diff --git a/docs/src/content/strings.json b/docs/src/content/strings.json
index 6e98855..6ea610f 100644
--- a/docs/src/content/strings.json
+++ b/docs/src/content/strings.json
@@ -96,7 +96,7 @@
"home.nav.primary": "Primary",
"home.nav.close": "Close navigation",
"home.hero.title": "Dates solved by the platform, written in natural language",
- "home.hero.lede": "Temporal and Intl gave the browser real time zones, DST-safe calendar math, and locale formatting. Native Dates wraps them in a readable, immutable API in {size} br.",
+ "home.hero.lede": "Temporal and Intl gave the browser real time zones, daylight-saving-safe calendar math, and deep locale customization. Native Dates wraps them in a readable, immutable API in {size} br.",
"home.install.label": "Install",
"home.install.withAgent": "With your agent",
"home.install.copy": "Copy install command",
@@ -174,7 +174,7 @@
"home.say.birthday.fromNow": "how far away",
"home.say.birthday.weekday": "what day of the week",
"home.prims.title": "Simple primitives for every measure of time",
- "home.prims.lede": "Dedicated immutable types for calendar days, clock times, zoned moments, durations, and ranges instead of overloading JavaScript Date.",
+ "home.prims.lede": "Instead of overloading JavaScript Date, use dedicated immutable types for each way you naturally think about time.",
"home.prims.switch": "Show each call in",
"home.prims.legacy": "Legacy JS",
"home.prims.date": "A calendar day",
@@ -208,12 +208,12 @@
"home.consoles.start.why": "setDate() mutates the Date instance in place. native-dates values are immutable, so plus() returns a new instance.",
"home.consoles.start.miss": "mutated in place",
"home.year.title": "Avoid learning the entire world’s confusing relationship with time",
- "home.year.lede": "Los Angeles and Berlin switch DST on different weekends, changing their offset {changes} a year. Temporal’s IANA database gives you that for free with zero bytes shipped in your bundle.",
+ "home.year.lede": "Los Angeles and Berlin switch DST on different weekends, changing their offset {changes} a year. Temporal’s IANA database calculates those offsets for free with zero bytes shipped.",
"home.year.changes.one": "{count} time",
"home.year.changes.other": "{count} times",
"home.year.gap": "{hours} hours apart",
"home.year.slider": "Day of the year",
- "home.year.caption": "A 9:30 AM Los Angeles standup converted to Berlin time across {year}. For {days}, the offset narrows from {far} hours to {near}, shifting the meeting to {time}.",
+ "home.year.caption": "A 9:30 AM Los Angeles meeting converted to Berlin time across {year}. For {days}, the offset narrows from {far} hours to {near}, shifting the meeting to {time}.",
"home.year.days.one": "{count} day",
"home.year.days.other": "{count} days",
"home.xray.title": "TC39-level precision without your code reading like a spec",
@@ -221,16 +221,16 @@
"home.xray.label": "Show the code",
"home.xray.lines.one": "{count} line",
"home.xray.lines.other": "{count} lines",
- "home.xray.standup": "I want to schedule a standup next Monday",
+ "home.xray.meeting": "I want to schedule a meeting next Monday",
"home.xray.invite": "I want to invite someone in {city}",
- "home.xray.due": "I want to set a due date next month",
- "home.xray.wait": "I want to count down to the standup",
+ "home.xray.due": "I want to set a due date at the end of next month",
+ "home.xray.wait": "I want to count down to the meeting",
"home.try.title": "Run it as if you were in {city}",
"home.try.lede": "Switch the preview’s time zone to simulate running in another city, or edit the code live.",
"home.try.label": "Live example: a meeting across zones",
"home.try.link": "See all examples",
"home.bench.title": "{ratio}× faster than the next fastest date library",
- "home.bench.lede": "Dates often show up in performance traces for apps, but no one ever built a head-to-head benchmark to figure out why, so we did. Run it yourself or add your own library to test.",
+ "home.bench.lede": "Date libraries often appear as problems in performance traces, but no one ever built a head-to-head benchmark to figure out which libraries were slow and why, so we did. Run it yourself or add your own library to test.",
"home.bench.caption": "Time to finish each task in milliseconds, by library",
"home.bench.task": "Task",
"home.bench.fastest": "fastest",
@@ -265,8 +265,8 @@
"home.bench.note.dst": "{percent}% correct",
"home.bench.run": "Medians of {rounds} runs in headless Chrome {chrome}, measured {date}.",
"home.bench.link": "See the full results",
- "home.bytes.title": "The whole core is {size}",
- "home.bytes.lede": "Core includes dates, times, zoned datetimes, durations, partial dates, ranges, calendar math, time zones, formatting, and relative time with zero dependencies. Toggle opt-in plugins to measure the combined bundle.",
+ "home.bytes.title": "Everything essential in {size}",
+ "home.bytes.lede": "Get 9 types of time, relative time, display formatting, and everything you expect in the core library. Use plugins to add optional features you might need.",
"home.bytes.link": "Browse all plugins",
"home.plugin.zones": "City names ('Berlin'), abbreviations ('PST'), and custom zone aliases",
"home.plugin.loose": "Lenient fallback parsing for non-ISO date strings",
diff --git a/docs/src/scripts/home/samples.js b/docs/src/scripts/home/samples.js
index 8b4cbb4..cbdeb1d 100644
--- a/docs/src/scripts/home/samples.js
+++ b/docs/src/scripts/home/samples.js
@@ -16,12 +16,12 @@ export function samplesFor(locale = 'en') {
const [homeZone, homeCity, inviteZone] = SAMPLE_ZONES[locale] ?? SAMPLE_ZONES.en;
return [
{
- id: 'standup',
- ours: `const standup = today().next('monday').at('9:30am', '${homeZone}');`,
+ id: 'meeting',
+ ours: `const meeting = today().next('monday').at('9:30am', '${homeZone}');`,
temporal: `const today = Temporal.Now.plainDateISO();
// the next Monday after today
const ahead = (8 - today.dayOfWeek) % 7 || 7;
-const standup = today.add({ days: ahead }).toZonedDateTime({
+const meeting = today.add({ days: ahead }).toZonedDateTime({
timeZone: '${homeZone}',
plainTime: '09:30',
});`,
@@ -36,15 +36,15 @@ const zone = { timeZone: '${homeZone}' };
// the swedish locale prints dates the way Date.parse reads them
const there = new Date(utc).toLocaleString('sv-SE', zone);
const offset = utc - Date.parse(there.replace(' ', 'T') + 'Z');
-const standup = new Date(utc + offset);`,
+const meeting = new Date(utc + offset);`,
},
{
id: 'invite',
- ours: `const invite = standup.in('${inviteZone}').format('full');`,
- temporal: `const invite = standup
+ ours: `const invite = meeting.in('${inviteZone}').format('full');`,
+ temporal: `const invite = meeting
.withTimeZone('${inviteZone}')
.toLocaleString(undefined, { dateStyle: 'full', timeStyle: 'short' });`,
- legacy: `const invite = standup.toLocaleString(undefined, {
+ legacy: `const invite = meeting.toLocaleString(undefined, {
dateStyle: 'full',
timeStyle: 'short',
timeZone: '${inviteZone}',
@@ -61,22 +61,22 @@ const due = new Date(today.getFullYear(), today.getMonth() + 2, 0);`,
},
{
id: 'wait',
- ours: "const wait = now().until(standup).round('minute').format();",
+ ours: "const wait = now().until(meeting).round('minute').format();",
temporal: `// Temporal.until() throws across time zones when largestUnit >= 'day'
const here = Temporal.Now.zonedDateTimeISO();
-const until = here.until(standup.withTimeZone(here.timeZoneId), {
+const until = here.until(meeting.withTimeZone(here.timeZoneId), {
largestUnit: 'year',
smallestUnit: 'minute',
roundingMode: 'halfExpand',
});
const wait = until.toLocaleString(undefined, { style: 'long' });`,
legacy: `// round to the minute, then step day-by-day across any DST transition
-const minutes = Math.round((standup - Date.now()) / 60_000);
-const from = new Date(standup - minutes * 60_000);
+const minutes = Math.round((meeting - Date.now()) / 60_000);
+const from = new Date(meeting - minutes * 60_000);
const after = (days) => new Date(from).setDate(from.getDate() + days);
let days = 0;
-while (after(days + 1) <= standup) { days++; }
-const rest = (standup - after(days)) / 60_000;
+while (after(days + 1) <= meeting) { days++; }
+const rest = (meeting - after(days)) / 60_000;
const hours = Math.floor(rest / 60);
const words = new Intl.DurationFormat(undefined, { style: 'long' });
const wait = words.format({ days, hours, minutes: rest % 60 });`,
diff --git a/docs/src/styles/docs.css b/docs/src/styles/docs.css
index 57db4de..ef5b9fb 100644
--- a/docs/src/styles/docs.css
+++ b/docs/src/styles/docs.css
@@ -249,9 +249,11 @@ h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.details[open] > summary { border-bottom: 1px solid var(--line); }
.details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.details-body { padding: 14px 16px; color: var(--text-2); }
+.details-body:has(> .table-wrap:only-child) { padding: 0; }
+.details-body > .table-wrap:only-child { border: 0; border-radius: 0; }
.doc .details-body > :first-child { margin-top: 0; }
.details-body p + p { margin-top: 12px; }
-.details-body .code { margin-top: 14px; }
+.details-body .code, .details-body .table-wrap { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) {
.details > summary::before { transition: none; }
}
|