s-age

Calculate years since a date (eg. a person's age given date of birth)

Usage no npm install needed!

<script type="module">
  import sAge from 'https://cdn.skypack.dev/s-age';
</script>

README

s-age

NPM version Dependencies build status NPM license

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)