Day.js

A 2KB immutable JavaScript date-time library with a Moment.js-compatible API

Library
npm
v1.11.23
48,666stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
81/100Excellent
Development Activity80
Maintenance76
Community68
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
87/100Excellent
Architecture88
Code Quality82
Innovation88
Learning Curve90

Day.js is a minimalist JavaScript library that parses, validates, manipulates, and displays dates and times for modern browsers. It was built as a drop-in-style replacement for Moment.js: it mirrors Moment’s chainable, immutable API almost method-for-method, so teams migrating away from Moment’s larger bundle size can often swap the import and keep most of their code working unchanged.

The entire core ships at roughly 2KB minified and gzipped, achieved by keeping the base class deliberately small and pushing everything non-essential — timezone support, relative time, custom parsing, ISO week calculations, and more — into an opt-in plugin system. Locale data for 140+ languages is similarly loaded on demand rather than bundled by default, so applications only pay for the date functionality and languages they actually use.

What You Get

  • A ~2KB core (dayjs.min.js) covering parsing, formatting, comparison, and arithmetic — small enough to have negligible impact on bundle size
  • A near-drop-in replacement for Moment.js’s API surface, easing migration from Moment-based codebases
  • 37 official plugins (timezone, relativeTime, customParseFormat, duration, isoWeek, advancedFormat, and more) that are opt-in via dayjs.extend() so unused functionality never ships to the client
  • Built-in internationalization with 140+ locale files, loadable individually
  • Full TypeScript type definitions maintained alongside the library
  • An immutable API — every date-producing method returns a new Dayjs instance instead of mutating the original

Common Use Cases

  • Formatting and displaying dates/times in a specific locale and format string in a web UI
  • Computing relative time strings (“3 hours ago”, “in 2 days”) via the relativeTime plugin
  • Converting and comparing dates across timezones with the timezone plugin (built on Intl)
  • Parsing user-supplied or API date strings with custom formats via customParseFormat
  • Date arithmetic in scheduling, booking, or analytics features (add/subtract days, weeks, months) without mutating shared date state
  • Replacing an existing Moment.js dependency to cut bundle size with minimal code changes

Under The Hood

Architecture Day.js centers on a single Dayjs class (src/index.js) that stores a native Date internally as $d, alongside cached primitives ($y, $M, $D, $H, $m, $s, $ms, $W) computed once in init() for fast repeated access. All value-changing methods (set, add, startOf, endOf) route through clone()/$set() and return a fresh instance, giving the library its immutability guarantee without a persistent-data-structure library underneath — it simply re-wraps a new native Date each time. The plugin system is the architectural centerpiece: dayjs.extend(plugin) calls each plugin once with (option, Dayjs, dayjs), letting plugins monkey-patch the prototype or the factory function directly. This is what keeps the core at 2KB — anything not universally needed (timezone math, ISO week numbers, relative time, custom parsing) lives in src/plugin/* and is opt-in.

Tech Stack The library has zero runtime dependencies — it only wraps the native Date, Intl, and RegExp APIs. The build pipeline uses Babel for transpilation and Rollup for bundling (see build/), with size-limit enforcing the 2.99KB budget in CI on every change to dayjs.min.js. TypeScript type definitions in types/ are hand-maintained rather than generated. Locale files under src/locale/ (143 of them) are independent modules following a common shape (month/weekday names, ordinal function, formats), so a consumer only pays for the locales they explicitly import.

Code Quality The project enforces 100% line coverage via Jest (coverageThreshold: { global: { lines: 100 } } in package.json), and the test suite runs across multiple timezones (TZ=Pacific/Auckland, TZ=Europe/London, TZ=America/Whitehorse) to catch timezone-dependent bugs before release — a detail that matters heavily for a date library. ESLint is configured with eslint-config-airbnb-base and runs as a pre-commit hook. The trade-off for the aggressive size budget is readability: internal state uses single/double-character property names ($y, $M, $D, $W) and terse helper methods (Utils.p, Utils.w, Utils.s) that prioritize minified output size over self-documenting code — acceptable for a stable, plugin-extensible core but a steeper read for first-time contributors than a more verbosely-named codebase.

API Design The public API is deliberately close to Moment.js’s (dayjs().format('YYYY-MM-DD'), .add(1, 'day'), .isBefore(other)), which minimizes the learning curve for the large existing population of Moment users and keeps method names predictable for newcomers. Getting started requires a single import and no configuration. The plugin activation pattern (dayjs.extend(plugin)) is consistent across all 37 plugins, and TypeScript definitions are automatically compatible with plugin-added methods when the corresponding .d.ts augmentation is imported. The one point of friction is discoverability: since most functionality lives behind opt-in plugins, users unfamiliar with the library often need to consult the docs to find out a needed feature (e.g. timezone conversion) isn’t in the core and requires an explicit dayjs.extend() call first.

Used by 94 apps in this directory

TypeScript
76%
AGPL 3.0

Abby

Developer Tools · Product Management

167

Statically typed feature flags, remote config, and A/B testing with framework-native SDKs for TypeScript teams.

View details
30
Repo Health
70
Technical
63
Dependency
Built with
TypeScript76%
MDX18%
Updated 1 years ago
TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
Python
99%
MIT

Agent Lightning

AI Development

17,500

A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.

View details
84
Repo Health
68
Technical
69
Dependency
Built with
Python99%
Updated today
TypeScript
59%
Other

agenta

Developer Tools · Devops · AI Development

4,489

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript59%
Python39%
Updated today
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
Python
49%
Other

Airbyte

Developer Tools · Data Engineering

21,916

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
67
Dependency
Built with
Python49%
Kotlin42%
Updated today
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,530

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
66
Dependency
Built with
Python90%
Updated today
TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search