Attributes
Very Popular
Repository
Current version released
4 years ago
Versions
- v2.22.1Latest
- v2.22.0
- v2.12.3
- v2.21.2
- v2.15.0
- v2.14.0
- v2.13.0
- v2.12.0
- v2.11.1
- v2.11.0
- v2.10.0
- v2.9.0
- v2.8.1
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.1
- v2.5.0
- v2.4.1
- v2.4.0
- v2.3.0
- v2.2.1
- v2.2.0
- v2.1.0
- v2.0.1
- v2.0.0
- v2.0.0-beta.5
- v2.0.0-beta.4
- v2.0.0-beta.3
- v2.0.0-beta.2
- v2.0.0-beta.1
- v2.0.0-alpha.37
- v2.0.0-alpha.36
- v2.0.0-alpha.35
- v2.0.0-alpha.34
- v2.0.0-alpha.33
- v2.0.0-alpha.32
- v2.0.0-alpha.31
- v2.0.0-alpha.30
- v2.0.0-alpha.29
- v2.0.0-alpha.28
- v2.0.0-alpha.27
- v2.0.0-alpha.26
- v2.0.0-alpha.25
- v2.0.0-alpha.24
- v2.0.0-alpha.23
- v2.0.0-alpha.22
- v2.0.0-alpha.21
- v2.0.0-alpha.20
- v2.0.0-alpha.19
- v2.0.0-alpha.18
- v2.0.0-alpha.17
- v2.0.0-alpha.16
- v2.0.0-alpha.15
- v2.0.0-alpha.14
- v2.0.0-alpha.13
- v2.0.0-alpha.12
- v2.0.0-alpha.11
- v2.0.0-alpha.10
- v2.0.0-alpha.9
- v2.0.0-alpha.8
- v2.0.0-alpha.7
- v2.0.0-alpha.6
- v2.0.0-alpha.5
- v2.0.0-alpha.4
- v2.0.0-alpha.3
- v2.0.0-alpha.2
- v2.0.0-alpha.1
- v1.30.1
- v1.30.0
- v1.29.0
- v1.28.5
- v1.28.4
- v1.28.3
- v1.28.2
- v1.28.1
- v1.28.0
- v1.27.2
- v1.27.1
- v1.27.0
- v1.26.0
- v1.25.0
- v1.24.0
- v1.23.0
- v1.22.0
- v1.21.1
- v1.21.0
- v1.20.1
- v1.20.0
- v1.19.0
- v1.18.0
- v1.17.0
- v1.16.0
- v1.15.1
- v1.15.0
- v1.14.1
- v1.14.0
- v1.13.0
- v1.12.1
- v1.12.0
- v1.11.2
- v1.11.1
- v1.11.0
- v1.10.0
date-fns provides the most comprehensive, yet simple and consistent toolset
for manipulating JavaScript dates in a browser & Node.js.
Lodash for dates
It’s like- 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 & Flow: Supports both Flow and TypeScript
- 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
# or with yarn
yarn add date-fns
Docs
See date-fns.org for more details, API, and other docs.