Skip to Content

dayjs

The Day.js rendering target. Imported from rosetta-date/libraries:

import { dayjs } from 'rosetta-date/libraries'
  • Base grammar: moment.
  • Extensions: none.
  • Support model: supports lists the canonical fields Day.js renders with its core formatter plus the AdvancedFormat and LocalizedFormat plugins.

Day.js mis-renders tokens it does not recognize at format time (rather than rejecting them), so converting to dayjs routes an unsupported field through onUnsupportedToken (reason unsupported-by-target) instead of emitting something broken.

Fields Day.js does not render

These canonical fields are outside Day.js’s support set, so converting them to dayjs is flagged. Example moment spellings are shown.

Fielde.g.
EraN NNNN NNNNN
Week-numbering year, 2-digitgg GG
Quarter, ordinalQo
Month, ordinalMo
ISO week of year, ordinalWo
Day of yearDDD DDDD DDDo
Weekday, number (ISO)E
Fractional second, 1–2 digitS SS

Plugin-gated tokens

Some fields Day.js renders only with a plugin loaded:

  • AdvancedFormat — quarter, day-of-month ordinal, week-of-year, ISO week-of-year, hour 1–24, week-numbering years, the Unix epoch, and time-zone name (Q, Do, w / wo / ww, W / WW, k / kk, gggg / GGGG, X, x, z).
  • LocalizedFormat — the L… presets.

rosetta-date emits these as-is; whether the plugin is actually loaded is the consumer’s concern (the same boundary supports draws between grammar and runtime configuration).

Localized presets

Through LocalizedFormat, dayjs spells the same L… family as momentjs:

MeaningToken
Date, short / medium / longL ll LL
Time, short / with secondsLT LTS
Date + time, medium / long / fulllll LLL LLLL
Last updated on