timeago-reverse

Getting approximate date from timeago generated string

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
timeago-reverse
431.0.1123 days ago5 years agoMinified + gzip package size for timeago-reverse in KB

Readme

Timeago reverse
Greenkeeper badge Build Status Coverage Status NPM version npm license
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)