Skip to content
Modern JavaScript date utility library ⌛️
JavaScript Shell
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Enable the Sponsor button Jun 3, 2019
config Remove locale tests Jun 20, 2019
docs Fix broken internal-links (#1396) Sep 6, 2019
examples Run TS build test to the smoke tests Aug 20, 2019
flow-typed Disable the problematic Galician locale (#886) Sep 21, 2018
scripts Disable auto tweet Sep 12, 2019
src Fix typo in the lightFormat docs (closes #1439) Sep 23, 2019
test Run TS build test to the smoke tests Aug 20, 2019
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 Use Jest to test date-fns in Node.js (#1192) (closes #875; closes #1066) Jun 8, 2019
.ts-eslintrc.js Add TypeScript definition file linting and building scripts Aug 20, 2019
CHANGELOG.md Update change log for v2.2.0 Sep 12, 2019
CONTRIBUTING.md Update REPL section of CONTRIBUTING.md to reflect changes to `toDate`… Jun 16, 2019
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 Slovenian (sl) locale for v2 (#1418) (closes #1415) Sep 12, 2019
package.json Run TS build test to the smoke tests Aug 20, 2019
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 Fix typings in set Sep 12, 2019
yarn.lock Add TypeScript definition file linting and building scripts Aug 20, 2019

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.