random-year

Generate a random year.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
random-year
001.0.27 years ago7 years agoMinified + gzip package size for random-year in KB

Readme

random-year
Generate a random year.

MIT License
build:? coverage:?

Install

$ npm install --save random-year 

Usage

var randomYear = require('random-year');

// API
// - randomYear([options]);

// options
// - min
// - max

By default, max is the current year and min is 100 years smaller than max.
randomYear();
// => 1998

Optionally specify min, max, or both to limit the range.
randomYear({ max: 2000 }); // min will be 1900
// => 1967

randomYear({ min: 1900 }); // max will be 2000
// => 1989

randomYear({ min: 1900, max: 2100 });
// => 2003

Related

Contributing

Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.