UNPKG

1.96 kBMarkdownView Raw
1<p align="center">
2 <a href="https://date-fns.org/">
3 <img alt="date-fns" title="date-fns" src="https://raw.githubusercontent.com/date-fns/date-fns/master/docs/logotype.svg" width="300" />
4 </a>
5</p>
6
7<p align="center">
8 <b>date-fns</b> provides the most comprehensive, yet simple and consistent toolset
9 <br>
10 for manipulating <b>JavaScript dates</b> in <b>a browser</b> & <b>Node.js</b>.</b>
11</p>
12
13<div align="center">
14
15[📖&nbsp; Documentation](https://date-fns.org/docs/Getting-Started/)&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;[🧑‍💻&nbsp; JavaScript Jobs](https://jobs.date-fns.org/)
16
17</div>
18
19<hr>
20
21# It's like [Lodash](https://lodash.com) for dates
22
23- It has [**200+ functions** for all occasions](https://date-fns.org/docs/Getting-Started/).
24- **Modular**: Pick what you need. Works with webpack, Browserify, or Rollup and also supports tree-shaking.
25- **Native dates**: Uses existing native type. It doesn't extend core objects for safety's sake.
26- **Immutable & Pure**: Built using pure functions and always returns a new date instance.
27- **TypeScript & Flow**: Supports both Flow and TypeScript
28- **I18n**: Dozens of locales. Include only what you need.
29- [and many more benefits](https://date-fns.org/)
30
31```js
32import { compareAsc, format } from 'date-fns'
33
34format(new Date(2014, 1, 11), 'yyyy-MM-dd')
35//=> '2014-02-11'
36
37const dates = [
38 new Date(1995, 6, 2),
39 new Date(1987, 1, 11),
40 new Date(1989, 6, 10),
41]
42dates.sort(compareAsc)
43//=> [
44// Wed Feb 11 1987 00:00:00,
45// Mon Jul 10 1989 00:00:00,
46// Sun Jul 02 1995 00:00:00
47// ]
48```
49
50The library is available as an [npm package](https://www.npmjs.com/package/date-fns).
51To install the package run:
52
53```bash
54npm install date-fns --save
55# or with yarn
56yarn add date-fns
57```
58
59## Docs
60
61[See date-fns.org](https://date-fns.org/) for more details, API,
62and other docs.
63
64<br />
65<!-- END OF README-JOB SECTION -->
66
67## License
68
69[MIT © Sasha Koss](https://kossnocorp.mit-license.org/)