项目作者: date-fns

项目描述 :
⏳现代JavaScript日期实用程序库⌛️
高级语言: JavaScript
项目地址: git://github.com/date-fns/date-fns.git
创建时间: 2014-10-06T10:24:22Z
项目社区:https://github.com/date-fns/date-fns

开源协议:Other

下载


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

date-fns

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
  1. import { compareAsc, format } from "date-fns";
  2. format(new Date(2014, 1, 11), "yyyy-MM-dd");
  3. //=> '2014-02-11'
  4. const dates = [
  5. new Date(1995, 6, 2),
  6. new Date(1987, 1, 11),
  7. new Date(1989, 6, 10),
  8. ];
  9. dates.sort(compareAsc);
  10. //=> [
  11. // Wed Feb 11 1987 00:00:00,
  12. // Mon Jul 10 1989 00:00:00,
  13. // Sun Jul 02 1995 00:00:00
  14. // ]

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

  1. npm install date-fns --save

Docs

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


License

MIT © Sasha Koss