Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # ![](https://cdn.rawgit.com/date-fns/date-fns/c5bcd92d04f14da194e6298101a6509b1c3b30f0/docs/logo.svg) date-fns
  2. 🔥🔥🔥 **date-fns v2 is out!** 🔥🔥🔥
  3. ⭐️ **Upgrading from v1 to v2?**
  4. - [See the changelog](https://github.com/date-fns/date-fns/blob/master/CHANGELOG.md)
  5. - Check out [@date-fns/upgrade](https://github.com/date-fns/date-fns-upgrade) and [@date-fns/upgrade-codemod](https://github.com/date-fns/date-fns-upgrade-codemod), they could help you with the upgrade!
  6. **date-fns** provides the most comprehensive, yet simple and consistent toolset
  7. for manipulating **JavaScript dates** in **a browser** & **Node.js**.
  8. **date-fns** is like [lodash](https://lodash.com) for dates. It has
  9. [**180+ functions** for all occasions](https://date-fns.org/docs/).
  10. ```js
  11. import { compareAsc, format } from 'date-fns'
  12. format(new Date(2014, 1, 11), 'yyyy-MM-dd')
  13. //=> '2014-02-11'
  14. const dates = [
  15. new Date(1995, 6, 2),
  16. new Date(1987, 1, 11),
  17. new Date(1989, 6, 10)
  18. ]
  19. dates.sort(compareAsc)
  20. //=> [
  21. // Wed Feb 11 1987 00:00:00,
  22. // Mon Jul 10 1989 00:00:00,
  23. // Sun Jul 02 1995 00:00:00
  24. // ]
  25. ```
  26. The library is available as an [npm package](https://www.npmjs.com/package/date-fns).
  27. To install the package run:
  28. ```bash
  29. npm install date-fns --save
  30. # or with yarn
  31. yarn add date-fns
  32. ```
  33. ## Docs
  34. [See date-fns.org](https://date-fns.org/) for more details, API,
  35. and other docs.
  36. ## JavaScript jobs by date-fns
  37. 👋 Know someone who's looking for JavaScript devs? [Recommend us a job!](https://jobs.date-fns.org/#recommend)
  38. ✉️ Get jobs worth sharing to your email! [Subscribe to the newsletter](https://jobs.date-fns.org).
  39. ## License
  40. [MIT © Sasha Koss](https://kossnocorp.mit-license.org/)