Parse dates in all the formats humans like to use.
Parse dates in all the formats humans like to use:
Return dates in just the format that computers should use:
$ npm install dehumanize-date
A simple function which takes a string as an argument and returns a string in the form
var date = dehumanizeDateuserInput;
The second parameter contains options. You can set whether to use US-style short dates, you can change what 'now' is for input like 'yesterday', and you can change the cutoff for 2-digit years that determines whether a given two-digit year is in the 21st or 20th century.
var date = dehumanizeDateuserInput usa: true now: cutoff: 80;
If you just want to use US formats for numerical dates you can also pass
true as the second parameter:
var date = dehumanizeDateuserInput true;