Questions tagged [date-fns]

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 or isBefore 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:

496 questions
-6
votes
1 answer

How to fetch numbers from string date value and format to american date input

I am using date-fns which only accept the date value like number. example: new Date(2019, 7, 15) But I am getting date value from input as: 07/15/2019 - string. how to convert this string value in to numbers like above mentioned? especially looking…
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
1 2 3
…
33
34