Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

date-fns

> 编程语言
Open source

⏳ Modern JavaScript date utility library ⌛️

36.6K stars0 likes2 views
WebsiteGitHub

About

⏳ Modern JavaScript date utility library ⌛️

🔥️ NEW: date-fns v4.0 with first-class time zone support is out!

date-fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js

👉 Documentation

👉 Blog


It's like Lodash for dates

  • It has 200+ functions for all occasions.
  • Modular: Pick what you need. Works with webpack, Browserify, or Rollup and also supports tree-shaking.
  • Native dates: Uses existing native type. It doesn't extend core objects for safety's sake.
  • Immutable & Pure: Built using pure functions and always returns a new date instance.
  • TypeScript: The library is 100% TypeScript with brand-new handcrafted types.
  • I18n: Dozens of locales. Include only what you need.
  • and many more benefits

Sponsored by:


javascript
import { compareAsc, format } from "date-fns";

format(new Date(2014, 1, 11), "yyyy-MM-dd");
//=> '2014-02-11'

const dates = [
  new Date(1995, 6, 2),
  new Date(1987, 1, 11),
  new Date(1989, 6, 10),
];
dates.sort(compareAsc);
//=> [
//   Wed Feb 11 1987 00:00:00,
//   Mon Jul 10 1989 00:00:00,
//   Sun Jul 02 1995 00:00:00
// ]

The library is available as an npm package. To install the package run:

bash
npm install date-fns --save

Docs

See date-fns.org for more details, API, and other docs.

License

MIT © Sasha Koss

Issues· 1028 open

View all issuesOpen on GitHub
  • #4334

    tzOffset accepts malformed UTC offsets in its manual fallback

    Updated Sep 29, 2026
  • #4340

    Will you go on a date with me?

    Updated Sep 28, 2026
  • #4338

    Temporal calculations use the host time zone for UTCDate

    Updated Sep 27, 2026
  • #4336

    Fractional hour steps can cause an infinite loop

    Updated Sep 27, 2026
  • #4329

    Support firstWeekContainsDate values other than 1 and 4

    Updated Sep 24, 2026
  • #4112

    "preprocessor" undefined

    Updated Sep 11, 2026
  • #4126

    Support bigint values for timestamp

    Updated Aug 27, 2026
  • #4284

    `addDays` produces an unexpected date when `amount` is a string

    Updated Aug 26, 2026
  • #4280

    Unable to parse date with locale zh-CN when value is any date in October

    Updated Aug 25, 2026
  • #3256

    Unable to parse date with locale `zh-CN` when value is any date in October

    🐛 Bug🌏 I18n✋ Help wantedUpdated Aug 25, 2026

> Tags

TypeScriptdatedate-fnshacktoberfestjavascript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言