Package Exports
- from-now
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (from-now) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
from-now 
Get relative time (ago) like 5 seconds, 12 hours, 3 months...
Install
$ npm install --save from-nowUsage
var fromNow = require('from-now');
fromNow('Tue Sep 14 2015 14:32:49 GMT+0100 (IST)');
fromNow(1444140297141);
fromNow(new Date());API
fromNow(input, translations)
input
Type: string, number or date object (everything that date constructor accept)
Time in past.
translations
Type: object
Default: {}
Custom translations that can be used for units.
Example
var fromNow = require('from-now');
var opts = {'seconds': {
1: 'sekunda',
2: 'sekundy',
5: 'sekund'
}};
fromNow('Tue Sep 14 2015 14:32:49 GMT+0100 (IST)', opts);It will match the nearest key that is smaller than interval.
1 second = 1 sekunda
2 seconds = 2 sekundy
3 seconds = 3 sekundy
4 seconds = 4 sekundy
5 seconds = 5 sekundYou can also use shorthand that will be used for all intervals.
var fromNow = require('from-now');
var opts = {'seconds': 's'};
fromNow('Tue Sep 14 2015 14:32:49 GMT+0100 (IST)', opts); // 15 sCheck the tests for more details.
License
MIT © Daniel Husar