Date FNS Date Library
date-fns.org
1
Leaving SiteNav
External Link Disclaimer
You are about to visit date-fns.org. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
Date FNS is a modern JavaScript date utility library created by Sasha Koss and Lesha Koss in 2015, providing over two hundred functions for parsing, formatting, manipulating, and comparing dates using the native JavaScript Date object, with a modular, functional API that enables tree-shaking for minimal bundle sizes, immutable operations that return new dates without modifying inputs, and TypeScript support with full type safety, serving as the leading alternative to Moment.js which is now in maintenance mode, adopted by over twelve million weekly npm users and companies including Vercel and Airbnb. The functional API treats every function as a pure function that takes a date and optional parameters, returning a new date or value without side effects, with functions like format for formatting dates using tokens, parse for parsing strings into dates, addDays, subMonths, addHours for date arithmetic, differenceInDays, differenceInBusinessDays for calculating intervals, isBefore, isAfter, isSameDay for comparisons, startOfDay, endOfWeek, startOfMonth for boundary calculations, eachDayOfInterval for generating ranges, and isWeekend, isToday for checks, with each function independently importable. The modular imports enable importing only the functions needed, with the import statement like import format from date-fns slash format adding only one kilobyte to the bundle, compared to Moment.js which adds over sixty kilobytes regardless of usage, making Date FNS ideal for performance-sensitive applications and serverless functions where bundle size directly impacts cold start times. The timezone support provides functions for working with IANA timezone identifiers. The locale support includes over seventy locales for internationalized formatting. The interval and duration types. The formatting tokens compatible with Unicode Technical Standard. Designed for JavaScript developers.
Statistics
1
Views
0
Clicks
0
Like
0
Dislike