get-decade
Get the decade from a date
Install
$ npm install --save get-decade
Usage
var getDecade = require('get-decade')
getDecade('1980-12-15')
// 80s
getDecade(new Date('1995-12-15'))
// 90s
This is a fairly low-level module and is subject to the silliness that is the JavaScript Date
object.
API
getDecade(date)
Returns the decade of the given date
.
date
Type: Date
or string
A Date
object or string that can be converted into one.
License
MIT © Juan Soto