get-decade

Get the decade from a date


Keywords
decade, decades, date, dates, years, get
License
MIT
Install
npm install get-decade@1.0.0

Documentation

get-decade

Get the decade from a date

Build Status

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