date-fns is a JavaScript date/time library that provides a comprehensive, simple and consistent toolset for manipulating JavaScript dates in a browser and Node.js.
date-fns provides a comprehensive, simple and consistent toolset for manipulating JavaScript dates in a browser and Node.js.
date-fns supports both Flow and TypeScript and it works well with module bundlers such as webpack, Browserify, or Rollup and also supports tree-shaking.
Features:
date-fns helps:
- showing JavaScript dates in a given
format
- checking if a date
isAfter
orisBefore
another - adding or removing units of time (
addHours
,subHours
,addMinutes
,subMinutes
etc)
and it offers other functionalities listed in the documentation.
Example:
Represent a given date in middle-endian format:
var result = format(
new Date(2014, 1, 11),
'MM/DD/YYYY'
)
//=> '02/11/2014'
Resources:
- Homepage
- Documentation
- GitHub project
- Support at Gitter
- Twitter: @date_fns