# date-fns

> Modern JavaScript date utility library

Source: https://talira.ai/catalog/date-fns-w93szbbe
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / dates and times](https://talira.ai/categories/libraries/dates-and-times), [languages / javascript](https://talira.ai/categories/languages/javascript)
- Licence: MIT[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Self-hostable: yes[^2]
- API: yes[^3]
- Creator: Sasha Koss (kossnocorp)
- Sponsors: CodeRabbit

date-fns is a library of more than 200 functions for working with JavaScript dates (formatting, parsing, arithmetic, comparisons, differences, intervals, start and end of periods) in browsers and Node.js. It works on native `Date` objects rather than a wrapper type, every function is pure and returns a new date, and the functions are separate modules, so bundlers keep only the ones you import. It is written in [TypeScript](https://talira.ai/catalog/typescript-w0asrgz8.md), ships dozens of locales that are included only when imported, and has curried versions of its functions in `date-fns/fp`. Since v4 (September 2024) time zones come from its own `@date-fns/tz` (`TZDate`) and `@date-fns/utc` (`UTCDate`) packages or each function's `in` option. Sasha Koss created it in 2014.

## Links

- Website: https://date-fns.org
- GitHub: https://github.com/date-fns/date-fns
- Docs: https://date-fns.org/docs/Getting-Started

## Problems it solves

- import only the date functions I use so my JavaScript bundle stays small
- format and parse dates in JavaScript without wrapping them in a custom date object
- count the business days between two dates in TypeScript
- date helpers that never mutate the Date I pass in, for React state
- adding hours across a daylight saving change gives the wrong time in the user's zone
- calculate dates in a specific time zone in Node.js, not the server's system zone
- check whether two date ranges overlap in JavaScript
- list every day in a month to render a calendar grid
- show a localized date like 'Tuesday, 3 March' in many languages
- compose date helpers in a functional pipeline with curried functions
- get the ISO week number of a date for a weekly report
- well-typed date utilities for a TypeScript codebase

## Features

- more than 200 functions: format, parse, add, sub, differenceIn*, isBefore, eachDayOfInterval, startOf*, endOf* and more
- works on native Date objects, no wrapper type
- pure, immutable functions that return a new date
- one module per function, tree-shakable; ESM-first with CommonJS builds
- written in TypeScript
- dozens of locales, included only when imported
- date-fns/fp: curried functions for composition
- time zones with TZDate (@date-fns/tz) and UTCDate (@date-fns/utc), or the in option on each function
- CDN builds in the @date-fns/cdn package

## Capabilities

- Has an API: plan not known

## Trust

Overall: 0.34 out of 1.
Signals: backing 0.35, extensibility 0.20.

- created by Sasha Koss (kossnocorp)
- sponsored by CodeRabbit

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [Day.js](https://talira.ai/catalog/day-js-evrthewv.md): Fast 2kB alternative to Moment.js with the same modern API
- [Moment.js](https://talira.ai/catalog/moment-js-sv97zp5y.md): Parse, validate, manipulate, and display dates in javascript.
- [Luxon](https://talira.ai/catalog/luxon-m1f352y5.md): A library for working with dates and times in JS

## Sources

[^1]: https://github.com/date-fns/date-fns/blob/main/pkgs/core/LICENSE.md (checked 20 Nov 2026)
[^2]: https://github.com/date-fns/date-fns (checked 20 Nov 2026)
[^3]: https://date-fns.org/docs/Getting-Started (checked 20 Nov 2026)
