# Extension points — moment/luxon

> Canonical page: https://codevetter.com/unpack/luxon/extension-points

# Extension points — moment/luxon

Scanned commit f427515a38f6a671f8de663e6bcc040ed81f114e (2026-08-09). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Extension primarily happens through configuration, factories, callback transformations, and explicit implementation tables. Zone is the clearest public behavioral interface, while Duration accepts custom conversion matrices and DateTime offers reusable token parsers. Parsing and formatting additions require coordinated changes rather than a dynamic registration API. Build targets and documentation plugins have separate, concrete integration points.
- Custom zones can implement Zone's behavioral interface; normalizeZone accepts Zone instances and also duck-types objects with an offset function, while localized formatting adapts custom zones through shifted UTC values. — [src/zone.js#L6-L41](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/zone.js#L6-L41) [src/impl/zoneUtil.js#L13-L33](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/impl/zoneUtil.js#L13-L33) [src/impl/locale.js#L256-L261](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/impl/locale.js#L256-L261)
- Settings.now is an injectable epoch-millisecond clock callback; defaultZone, locale, numbering system, output calendar, and week settings customize newly constructed instances. — [src/settings.js#L24-L57](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/settings.js#L24-L57) [src/settings.js#L60-L105](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/settings.js#L60-L105) [src/settings.js#L122-L130](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/settings.js#L122-L130)
- Duration.fromObject accepts opts.matrix, its constructor gives a supplied matrix precedence over casual/longterm presets, and reconfigure can replace conversion configuration. — [src/duration.js#L186-L192](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/duration.js#L186-L192) [src/duration.js#L253-L267](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/duration.js#L253-L267) [src/duration.js#L703-L706](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/duration.js#L703-L706) [test/duration/customMatrix.test.js#L6-L32](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/test/duration/customMatrix.test.js#L6-L32)
- DateTime.buildFormatParser constructs a reusable TokenParser; fromFormatParser checks Locale equality before consuming its explanation result and passing fields into normal construction. — [src/datetime.js#L2392-L2399](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/datetime.js#L2392-L2399) [src/datetime.js#L2412-L2445](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/datetime.js#L2412-L2445)
- New standard date grammars fit the regex/extractor composition in regexParser.js: combineRegexes anchors patterns, combineExtractors merges fields/zones, and parse tries explicit alternatives in order. — [src/impl/regexParser.js#L13-L54](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/impl/regexParser.js#L13-L54) [src/impl/regexParser.js#L255-L295](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/impl/regexParser.js#L255-L295)
- Custom token additions must coordinate unitForToken's parsing switch, Formatter's output switch, and macroTokenToFormatOpts when presets are involved. — [src/impl/tokenParser.js#L57-L95](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/impl/tokenParser.js#L57-L95) [src/impl/formatter.js#L17-L38](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/impl/formatter.js#L17-L38) [src/impl/formatter.js#L300-L329](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/impl/formatter.js#L300-L329)
- Duration.mapUnits validates callback results numerically and clones the quantity; Interval.mapEndpoints applies a callback to both endpoints and reconstructs through endpoint validation. — [src/duration.js#L663-L669](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/duration.js#L663-L669) [src/interval.js#L691-L692](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/interval.js#L691-L692) [src/interval.js#L89-L102](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/src/interval.js#L89-L102)
- Distribution targets plug into buildLibrary options and buildAll's target list; documentation plugins append to $docsify.plugins, and new guide navigation belongs in the sidebar list. — [tasks/build.js#L125-L174](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/tasks/build.js#L125-L174) [site/plugins/dark-theme-toggle.js#L26-L27](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/site/plugins/dark-theme-toggle.js#L26-L27) [site/docs/_sidebar.md#L1-L15](https://github.com/moment/luxon/blob/f427515a38f6a671f8de663e6bcc040ed81f114e/site/docs/_sidebar.md#L1-L15)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
