timeago-reverse
v1.0.11
Published
Getting approximate date from timeago generated string
Downloads
2,360
Maintainers
Readme
Timeago reverse
Parse timeago expression (ie. 2 days ago
) and get an approximate Date object.
Installation
npm i timeago-reverse
Test
npm test
How to use?
const tr = require('timeago-reverse');
const myDate = tr.parse('14 hours ago');
Supported expressions
Now
now
just now
any moment now
Special cases
tomorrow
today
yesterday
less than a minute
less than a minute ago
in less than a minute
Past variations
Format: [a/an/${amount}] ${unit} [ago]
second
second ago
a second
a second ago
an hour
1 second ago
30 seconds
30 seconds ago
Future variations
Format: [in] [a/an/${amount}] ${unit} [from now]
second from now
a second from now
1 second from now
30 seconds from now
in second
in a second
in 1 second
in 20 seconds
Supported units
Supported in both singular and plural forms.
- second(s)
- sec(s)
- minute(s)
- min(s)
- hour(s)
- day(s)
- week(s)
- month(s)
- mth(s)
- year(s)