🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

moment-interpret

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-interpret

An intepreter built on top of MomentJS

0.1.2
latest
Source
npm
Version published
Maintainers
1
Created
Source

Moment Interpret

An intepreter built on top of MomentJS

npm install moment-interpret
var interpret = require('moment-interpret');

Examples

interpret('3 days ago'); --> Returns three days from the current time
interpret('three hours ago'); --> Also supports written out words

interpret('5 years from now');
interpret('eleven months from now');

Formatting

This module is built on top of MomentJS, so it supports all the same formatting MomentJS gives you.

For example:

interpret('4 days ago').format('YYYY-MM-DD');

To see all the different formatting options, please look at the MomentJS docs.

Notes

  • Currently only supports numbers less than 100
  • Supports the following wordings:
    • '...ago'
    • '...from now...'
  • Support the following types of times:
    • Years
    • Months
    • Days
    • Hours
    • Minutes
    • Seconds

Todo

  • Support numbers 100 or greater
  • Add more options for possible wordings

Keywords

momentjs

FAQs

Package last updated on 26 Oct 2014

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