dehumanize-date

Parse dates in all the formats humans like to use.

npm install dehumanize-date
16 downloads in the last week
36 downloads in the last month

dehumanize-date

Parse dates in all the formats humans like to use:

  • today/tomorrow/yesterday
  • next/this/last Wednesday
  • 12th January
  • 12th January 1950
  • 09-08-2008
  • 2008-08-09

Build Status Dependency Status NPM version

testling badge

Installation

$ npm install dehumanize-date

Usage

A simple function which takes a string as an argument and returns a plain JavaScript date object.

var date = dehumanizeDate(userInput);

Note that the "time" portion of the date will be 00:00:00.000 in UTC.

If you want to use US formats for numerical dates you should pass true as the second parameter:

var date = dehumanizeDate(userInput, true);

License

MIT

npm loves you