Skip to content
Modern JavaScript date utility library ⌛️
JavaScript Shell
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Enable the Sponsor button Jun 3, 2019
config Fix Karma warning for webpack build (#1481) (closes #1223) Oct 16, 2019
docs Fix example in the Time Zones doc (closes #1473) May 5, 2020
examples Bump TypeScript to 3.7.2 (#1556) Jan 3, 2020
flow-typed Disable the problematic Galician locale (#886) Sep 21, 2018
scripts Remove flow check from CI flow May 17, 2020
src Build the library for v2.14.0 May 18, 2020
test Fix DST issues with differenceInDays (fixes #1750) (#1754) May 6, 2020
tmp Speed up TZ tests using pre-build tests file Oct 1, 2015
.babelrc.js Add parameters and destructuring Babel plugins Jun 26, 2019
.editorconfig Add EditorConfig config Apr 25, 2016
.eslintignore Install ESLint and fix recommended rules (closes #947) Jun 14, 2019
.eslintrc.js Install ESLint and fix recommended rules (closes #947) Jun 14, 2019
.flowconfig Use Jest to test date-fns in Node.js (#1192) (closes #875; closes #1066) Jun 8, 2019
.gitignore Remove some obsolete leftover changes Aug 20, 2019
.prettierrc.js Extract Prettier config from package.json (closes #1068) Jun 14, 2019
.tool-versions Use Jest to test date-fns in Node.js (#1192) (closes #875; closes #1066) Jun 8, 2019
.travis.yml Upgrade Node.js to v12 on Travis CI Oct 22, 2019
.ts-eslintrc.js Get rid of Function in Flow type definitions (#1520) Nov 7, 2019
CHANGELOG.md Add a changelog entry for v2.14.0 May 18, 2020
CONTRIBUTING.md Remove instructions to update the changelog (closes #1787) (skip ci) May 18, 2020
LICENSE.md Update LICENSE file Apr 25, 2016
README.md Update README Aug 23, 2019
benchmark.js Add performance tests (#289) Dec 9, 2016
jest.config.js Remove some obsolete leftover changes Aug 20, 2019
outdatedLocales.json Update Macedonian locale for v2 (closes #1531) (#1649) Mar 13, 2020
package.json Add funding property to package.json Apr 14, 2020
test.js Add tests buildFormatFormatters of en locale Oct 11, 2016
testWithoutLocales.js Replace phantomjs with Chrome in `v1.x` (#476) Apr 14, 2017
tsconfig.json Remove some obsolete leftover changes Aug 20, 2019
typings.d.ts Build the library for v2.14.0 May 18, 2020
yarn.lock Bump TypeScript to 3.7.2 (#1556) Jan 3, 2020

README.md

date-fns

🔥🔥🔥 date-fns v2 is out! 🔥🔥🔥

⭐️ Upgrading from v1 to v2?

date-fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.

date-fns is like lodash for dates. It has 180+ functions for all occasions.

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.

JavaScript jobs by date-fns

👋 Know someone who's looking for JavaScript devs? Recommend us a job!

✉️ Get jobs worth sharing to your email! Subscribe to the newsletter.

License

MIT © Sasha Koss

You can’t perform that action at this time.