Socket
Socket
Sign inDemoInstall

moment-interpret

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    moment-interpret

An intepreter built on top of MomentJS


Version published
Maintainers
1
Install size
5.10 MB
Created

Readme

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

FAQs

Last updated on 26 Oct 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc