With the function-per-file style, you can pick just what you need and stop bloating your project with useless functionality.
It works well with modern module bundlers such as webpack, Browserify, or Rollup and also supports tree-shaking.
date-fns doesn't reinvent the wheel and uses the existing native type. Also, it doesn't extend core objects for safety sake.
Functions in date-fns work predictable and stick to ECMAScript behavior in edge cases.
date-fns is built using pure functions and always returns a new date instance instead of changing the passed one.
It allows to prevent bugs and skip long debugging sessions.
date-fns supports both Flow and TypeScript.
The typings are generated from the source code and bundled with the package, so they always up-to-date.
The functional programming submodule provides a better alternative to chaining — composition, which makes your code clean, safe and doesn't bloat your build.
With the support of an amazing community, date-fns have dozens of locales. But none of them will be included in your build unless you use that.
It always returns a date in the same time zone, no matter what's passed, a timestamp, a string or a date object.
The API is tailored to have predictable names and arguments order.
date-fns respects timezones & DST.
It follows semantic versioning so, always backward compatible.
Each build CI checks more than 650 000 examples in about 400 time zones.
The best API is an API that doesn't exist. With date-fns you always have one function that does one thing.
The API is unambiguous, and there is always a single approach to a problem.
In addition to tiny size, date-fns is fast. You can be sure that your users will have the best user experience.
Every date-fns has detailed description with examples. The documentation is accessible both online, at the website, and offline thank to JSDoc annotations.
date-fns is an active development and we have plans to add more features.