s-age
v1.1.2
Published
Calculate years since a date (eg. a person's age given date of birth)
Downloads
2,140
Readme
s-age
Usage
s-age
is a function that calculates years since a date. Input can be a date string, timestamp, or Date
object.
var age = require('s-age');
age('2012'); // returns 6 (in 2018)
age('Dec 2 2012'); // returns 5 (in January 2018)
age(new Date()); // returns 0
age(1356728100000); // returns 5 (in 2018)