date-fns
Web framework / library · Free
Modular JavaScript date functions: they handle parsing, calculations, and formatting without a large shared runtime object.
Also known as: date-fns/date-fns; modern-js-date-utils

What you can use for free
Code and local use under MIT, as declared in the official README.
Paid features and costs
Computing resources, self-hosting, and external services are paid for separately if used.
Access and limitations
Code and local use under MIT (as stated in the official README). Computing resources, self-hosting, and external services are paid for separately if used.
Use cases
- Check date calculations and formats
- Connect date functions to a locale and real boundary examples
Example workflow
A possible workflow; this is not a report of hands-on testing.
Check date calculations and formats.
Before you start
- Web application source code and the intended workflow.
- The project's framework and runtime version.
Steps
- Choose parsing/formatting operations for date inputs.
- Connect date functions to a locale and real boundary examples.
- Add real data and error handling; check the production build.
Check your result
- The workflow works after a page refresh and with invalid data.
- The bundle, server rendering, and supported browsers suit the project.
Choosing date-fns
Check date calculations and formats
Choose this when
- Check date calculations and formats
- Connect date functions to a locale and real boundary examples
Requirements
- Import required functions and locales rather than unconditionally including the entire library.
Things to consider
- Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
- Terms of use: MIT (as stated in the official README).
Frequently asked questions
What can you use for free in date-fns?
Code and local use under MIT, as declared in the official README.
What additional costs might arise with date-fns?
Computing resources, self-hosting, and external services are paid for separately if used.
What terms of use matter for date-fns?
MIT (as stated in the official README).
How do you get started with date-fns?
Choose parsing/formatting operations for date inputs. Connect date functions to a locale and real boundary examples. Add real data and error handling; check the production build.
How can I reduce date code size in an application?
date-fns consists of modular functions with tree shaking; load locales as needed. Functions do not mutate supplied dates and return new values. The README notes time zone support in version 4; choose zones through that version's API rather than assuming every formatting operation handles zones automatically.
License
MIT (as stated in the official README).
MIT — permissive license
You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.
License termsTechnologies and topics
- date-fns
- web
- Development