Parse simple relative time in human readable format to milliseconds.
Parse simple relative time in human readable format to milliseconds.
Parameters
input
string Human readable format of relative time
Examples
parseRelativeTime('2 days'); // --> 172800000
parseRelativeTime('-2 days');
parseRelativeTime('in 2 days');
parseRelativeTime('2 days ago');
Returns (null | number)
If you found any bugs, if you have feature requests or any questions, please, either file an issue at GitHub or send me an e-mail at riki@fczbkk.com.
parseRelativeTime is published under the MIT license.