dayjs
Fast, 2KB date library for JavaScript — a Moment.js-compatible API with a tiny footprint and plugin system.
dayjs
General JSFast, 2KB date library for JavaScript — a Moment.js-compatible API with a tiny footprint and plugin system.
Fit
Bundle (gzip)
3.0 kB
7.1 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Moment.js is mutable, over 66KB minified, and no longer actively developed. The native Date API lacks formatting, relative time, timezone support, and chainable manipulation methods.
What It Does
Day.js parses, validates, manipulates, and formats dates with an API nearly identical to Moment.js. It's immutable by default, weighs ~2KB, and extends via plugins (timezone support, relative time, ISO week, etc.) that are only loaded when needed.
Installation
npm install dayjsUsage Example
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import timezone from 'dayjs/plugin/timezone';
import utc from 'dayjs/plugin/utc';
dayjs.extend(relativeTime);
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs('2025-01-15').format('MMMM D, YYYY'); // 'January 15, 2025'
dayjs().subtract(3, 'day').fromNow(); // '3 days ago'
dayjs().tz('America/New_York').format('h:mm A'); // '9:30 AM'
dayjs('2025-01-01').isBefore('2025-06-01'); // trueRelated packages
Unified TypeScript SDK for building AI-powered apps — switch between 20+ LLM providers without rewriting code.
animejsGeneral JSLightweight JavaScript animation library with a tiny footprint and a powerful, expressive API.
AOSGeneral JSAn easy-to-use library that makes elements fade, slide, or zoom into view as the user scrolls down your page.
archiverGeneral JSStreaming interface for generating ZIP and TAR archives in Node.js — create compressed archives programmatically from files, directories, and buffers.
@formkit/auto-animateGeneral JS> Add smooth transitions to any element with a single line — zero-config animations for adds, removes, and moves.