1.0.11 • Published 3 years ago
timeago-reverse v1.0.11
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
nowjust nowany moment now
Special cases
tomorrowtodayyesterdayless than a minuteless than a minute agoin less than a minute
Past variations
Format: [a/an/${amount}] ${unit} [ago]
secondsecond agoa seconda second agoan hour1 second ago30 seconds30 seconds ago
Future variations
Format: [in] [a/an/${amount}] ${unit} [from now]
second from nowa second from now1 second from now30 seconds from nowin secondin a secondin 1 secondin 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)