Skip to content

Support for Graphite-style relative time strings in Moment.js

License

Notifications You must be signed in to change notification settings

bbc/moment-relative

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moment-relative

Build Status Code Climate

Support for Graphite-style relative time strings in Moment.js

Installation

npm install moment-relative

Usage

var moment = require('moment-relative');

var now = moment();
var someTimeAgo = now.relative('-5d3h5m');
// equivalent of now.subtract(5, 'days').subtract(3, 'hours').subtract(5, 'minutes');

Supported units

Unit Description
d Days
h Hours
m Minutes
s Seconds

About

Support for Graphite-style relative time strings in Moment.js

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •