Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ages

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ages

Your terrible time estimator.

  • 0.2.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ages

Your terrible time estimator.

Example

ages.until(weekFromNow); // 1w

ages.until(now); // 1m

ages.until(inAThousandYears); // ?

ages.ago(tuesday, thursday); // 2d

ages.ago(nextWeek, today); //-1w

ages.ago(theNineties); // ? (im so old)

// customize formatting
// live life dangerously
ages.ago(a, b, {
  minute: 'years',
  hour: 'minutes',
  day: 'week',
  week: 'years',
  month: '?',
  year: 'month',
  fallback: 'seconds'
});

API

ages.ago(target[, fromDate[, formats]]) -> String

Returns an estimate of how long ago a given date was.

Takes the following arguments:

  • target Date|String|Number - the target date
  • fromDate Date|String|Number - the start date (defaults to now)
  • formats Object - customize formatting of different units
ages.until(target[, fromDate[, formats]]) -> String

Returns an estimate of how long until given a date is.

Takes the following arguments:

  • target Date|String|Number - the target date
  • fromDate Date|String|Number - the start date (defaults to now)
  • formats Object - customize formatting of different units
ages.msToString(ms[, formats]) -> String

Returns a rough estimation of the milliseconds given.

Takes the following arguments:

  • ms Number - positive time in milliseconds
  • formats Object - customize formatting of different units

Keywords

FAQs

Package last updated on 04 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc