expiry-js
A lightweight Javascript Universal Module for parsing durations.
I developed it as a utility for managing Redis expiries.
Installation
npm install expiry-js
bower install expiry-js
Usage
var
expiry = require('expiry-js');
var
example = expiry('1Y1M2W3D5h8m11s19ms'),
year = expiry('1Y'),
month = expiry('1M'),
week = expiry('1W'),
day = expiry('1D'),
hour = expiry('1h'),
minute = expiry('1m'),
second = expiry('1s'),
milliseconds = expiry('1ms');
console.log(day.valueOf());
console.log(day.asMilliseconds());
console.log(day.asSeconds());