timeago-reverse

1.0.11 • Public • Published

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)

Package Sidebar

Install

npm i timeago-reverse

Weekly Downloads

572

Version

1.0.11

License

MIT

Unpacked Size

44 kB

Total Files

20

Last publish

Collaborators

  • ezrepotein