INSTALL
Type:
Version:
- Static
- Latest Patch
- Latest Minor
- Latest Major
- 4.1.0
- 4.0.0
- 3.6.0
- 3.5.0
- 3.4.0
- 3.3.1
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.30.0
- 2.29.3
- 2.29.2
- 2.29.1
- 2.29.0
- 2.28.0
- 2.27.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.1
- 2.22.0
- 2.21.3
- 2.21.2
- 2.21.1
- 2.21.0
- 2.20.3
- 2.20.2
- 2.20.1
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.1
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.1
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.1
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.1
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.30.1
- 1.29.0
- 1.28.5
- 1.28.4
- 1.28.3
- 1.28.2
- 1.28.1
- 1.28.0
- 1.27.2
- 1.27.1
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.1
- 1.21.0
- 1.20.1
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.1
- 1.15.0
- 1.14.1
- 1.14.0
- 1.13.0
- 1.12.1
- 1.12.0
- 1.11.2
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.11
- 0.14.9
- 0.14.8
- 0.14.5
- 0.13.0
- 0.12.1
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
- 4.0.0-beta.1
- 4.0.0-alpha.1
- 3.0.2-rc.1
- 3.0.1-rc.1
- 3.0.0-rc.2
- 3.0.0-rc.1
- 3.0.0-beta.1
- 3.0.0-alpha.2
- 3.0.0-alpha.1
- 2.0.0-beta.5
- 2.0.0-beta.4
- 2.0.0-beta.3
- 2.0.0-beta.2
- 2.0.0-beta.1
- 2.0.0-alpha.37
- 2.0.0-alpha.36
- 2.0.0-alpha.35
- 2.0.0-alpha.34
- 2.0.0-alpha.33
- 2.0.0-alpha.32
- 2.0.0-alpha.31
- 2.0.0-alpha.30
- 2.0.0-alpha.29
- 2.0.0-alpha.28
- 2.0.0-alpha.27
- 2.0.0-alpha.26
- 2.0.0-alpha.25
- 2.0.0-alpha.24
- 2.0.0-alpha.23
- 2.0.0-alpha.22
- 2.0.0-alpha.21
- 2.0.0-alpha.20
- 2.0.0-alpha.18
- 2.0.0-alpha.16
- 2.0.0-alpha.14
- 2.0.0-alpha.13
- 2.0.0-alpha.11
- 2.0.0-alpha.10
- 2.0.0-alpha.9
- 2.0.0-alpha.8
- 2.0.0-alpha.7
- 2.0.0-alpha.6
- 2.0.0-alpha.5
- 2.0.0-alpha.4
- 2.0.0-alpha.3
- 2.0.0-alpha.2
- 2.0.0-alpha.1
- 1.0.0-rc9
- 1.0.0-rc8
- 1.0.0-rc6
- 1.0.0-rc5
- 1.0.0-rc4
- 1.0.0-rc3
- 1.0.0-rc22
- 1.0.0-rc21
- 1.0.0-rc2
- 1.0.0-rc19
- 1.0.0-rc18
- 1.0.0-rc17
- 1.0.0-rc16
- 1.0.0-rc15
- 1.0.0-rc14
- 1.0.0-rc13
- 1.0.0-rc12
- 1.0.0-rc11
- 1.0.0-rc10
- 1.0.0-rc1
- 1.0.0-alpha4
- 1.0.0-alpha3
- 1.0.0-alpha2
- 1.0.0-alpha1
🔥️ 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
👉 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
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:
npm install date-fns --save
Docs
See date-fns.org for more details, API, and other docs.