CodeVetter · Repo Unpack · Feature catalog
moment/luxon
Luxon's user-facing surface is primarily its JavaScript API. DateTime handles construction, parsing, transformations, formatting, and interoperability; Duration models quantities, and Interval models bounded spans. Info exposes locale and zone metadata, while Settings controls defaults and invalid-value policy. The companion site provides searchable guides, API documentation, runnable examples, and a persistent theme preference.
- DateTime.now reads the configured clock; fromObject accepts Gregorian, ordinal, ISO-week, and locale-week fields, rejecting conflicting representations and out-of-range values.
- DateTime supports ISO, RFC 2822, HTTP, SQL, and explicit custom-format parsing; custom parsing also has explain and reusable-parser APIs.
- DateTime formats tokens, localized strings, and localized parts; ISO output supports precision and offset options, while JSON, BSON, numeric timestamps, and native Date provide interoperability.
- DateTime offers zone conversion with optional wall-time preservation, calendar-aware plus/minus, endOf, diff, and relative or relative-calendar descriptions.
- Duration parses ISO quantities and ISO times, performs unit conversion with casual/longterm/custom matrices, and emits human-readable, object, ISO, JSON, or millisecond representations.
- Interval represents half-open spans, accepts endpoint or duration-based construction, supports containment and splitting, and exposes intersection, union, merge, xor, difference, and duration conversion.
- Info exposes localized date labels, IANA-zone validation, DST detection, week-start/weekend metadata, and relative/localeWeek feature detection; Settings supplies defaults and throwOnInvalid.
- The documentation site enables search and sidebar guides, the demo renders API examples, and its dark-theme plugin remembers the selected theme in localStorage.