How iamkun/dayjs works
Day.js is a lightweight, immutable date-and-time library. Its principal workflow is to construct a date from input, validate and manipulate it through a chainable API, then query or format the result. Locale handling and opt-in plugins extend that core with parsing formats, durations, calendar and week operations, relative time, and UTC/time-zone support. The graph reflects the README’s capability descriptions and the sampled source; relationships for unsampled plugin implementations are not inferred beyond documented plugin loading.
Main entry points: src/index.js Day.js API · constant.js Time constants · timezone/index.js Time-zone conversion · utc/index.js UTC offsets
Components 19
Core date API
- Day.js API
src/index.js - Date parsing
src/index.js - Date operations
src/index.js - Date queries
src/index.js - Date formatting
src/index.js - Date utilities
src/utils.js - Time constants
src/constant.js
Locale and parsing
- Locale management
src/index.js - Locale data API
src/plugin/localeData/index.js - Localized formats
src/plugin/localizedFormat/utils.js - Custom format parsing
src/plugin/customParseFormat/index.js
Calendar extensions
- Duration arithmetic
src/plugin/duration/index.js - Week calculations
src/plugin/isoWeek/index.js - Calendar plugins
src/plugin - Relative time
src/plugin/relativeTime/index.js
Time-zone extensions
- UTC offsets
src/plugin/utc/index.js - Time-zone conversion
src/plugin/timezone/index.js - Time plugins
src/plugin
Other components
- Library consumer
Connections 26
- Library consumer → Day.js API: uses date API
- Day.js API → Date parsing: parses input
src/index.js - Day.js API → Date operations: manipulates dates
src/index.js - Day.js API → Date queries: queries dates
src/index.js - Day.js API → Date formatting: formats dates
src/index.js - Day.js API → Date utilities: uses utilities
src/index.js - Day.js API → Time constants: uses constants
src/index.js - Day.js API → Locale management: manages locales
src/index.js - Library consumer → Locale data API: loads optionally
- Library consumer → Localized formats: loads optionally
- Library consumer → Custom format parsing: loads optionally
- Custom format parsing → Localized formats: uses format helpers
src/plugin/customParseFormat/index.js - Locale data API → Localized formats: uses format helpers
src/plugin/localeData/index.js - Library consumer → Duration arithmetic: loads optionally
- Library consumer → Week calculations: loads optionally
- Library consumer → Relative time: loads optionally
- Library consumer → Calendar plugins: loads optionally
- Duration arithmetic → Time constants: uses time constants
src/plugin/duration/index.js - Week calculations → Time constants: uses unit constants
src/plugin/isoWeek/index.js - Relative time → Time constants: uses time constants
src/plugin/relativeTime/index.js - Library consumer → UTC offsets: loads optionally
- Library consumer → Time-zone conversion: loads optionally
- Library consumer → Time plugins: loads optionally
- UTC offsets → Time constants: uses offset constants
src/plugin/utc/index.js - Time-zone conversion → Time constants: uses time constants
src/plugin/timezone/index.js - Time-zone conversion → UTC offsets: calls UTC API
src/plugin/timezone/index.js