CodeVetter · Repo Unpack · Behavior traces
moment/luxon
These traces follow implementation order from public calls to outputs. Construction and parsing resolve zone, locale, validity, and timestamp before later operations run. Arithmetic revisits zone offsets after calendar and elapsed-time changes, while formatting crosses into native Intl. Serialization supplies a caller-owned persistence boundary; the documentation theme is a separate concrete browser-storage flow.
- Current-time flow: DateTime.now → new DateTime({}) → Settings.defaultZone/normalizeZone → Settings.now → zone.offset → tsToObj → Locale.create, producing an instance with derived calendar fields.
- ISO flow: DateTime.fromISO → parseISODate → parse and its matching extractor → parseDataToDateTime → DateTime.fromObject → objToTS/fixOffset → optional setZone; unmatched input becomes an unparsable DateTime.
- Custom-format flow: fromFormat → Locale.fromOpts(defaultToEN) → parseFromTokens → TokenParser construction → explainFromTokens → parseDataToDateTime; missing arguments throw, while parser-invalid results create an invalid DateTime.
- Calendar-addition flow: plus({days: 1}) → Duration.fromDurationLike → Duration.fromObject → adjustTime → objToLocalTS → fixOffset → clone; adding hours instead contributes elapsed milliseconds after calendar resolution.
- Localized-format flow: toLocaleString → loc.clone → Formatter.create → formatDateTime → Locale.dtFormatter → PolyDateFormatter → getCachedDTF → format; substituted zones use formatToParts and zone.offsetName.
- Interval flow: fromISO splits start/end text → parses start with setZone:true → parseISOIntervalEnd → parseDataToDateTime with start timestamp/zone as context → restores requested zones → fromDateTimes/validateStartEnd; duration alternatives use after or before.
- Serialization flow: DateTime.toJSON → toISO → validity check → precision normalization → toISODate/toISOTime; invalid dates emit null, and restoring ISO text uses fromISO without restoring the original Locale configuration.
- Theme-persistence flow: the Docsify plugin initializes the localStorage preference from matchMedia if absent → hook.init applies it → hook.doneEach installs controls → click invokes applyTheme(true), writes the preference, and changes stylesheet/body state.