random-year
v1.0.2
Published
Generate a random year.
Downloads
17,892
Maintainers
Readme
random-year
Generate a random year.
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
- random-month - Generate a random month.
- random-day - Generate a random day of a month.
- random-hour - Generate a random hour.
- random-minute - Generate a random minute.
- random-second - Generate a random second.
- random-millisecond - Generate a random millisecond.
- random-weekday - Generate a random weekday.
- random-datetime - Generate a random date.
- random-ampm - Return am or pm. Very simple.
- random-timestamps - Generate a timestamp.
- random-hammertime - Generate a random hammertime.
Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.