random-day
v1.0.1
Published
Generate a random day.
Downloads
17,530
Maintainers
Readme
random-day
Generate a random day.
Install
$ npm install --save random-day
Usage
var randomDay = require('random-day');
// API
// - randomDay([options]);
// options
// - year
// - month
// - min
// - max
By default, returns a day in a random month, from 1
to 31
.
randomDay();
// => 23
Optionally specify month:
randomDay({ month: 1 }); // 1~31
// => 12
Optionally specify year when month is 2
to figure out leap years:
randomDay({ year: 2016 month: 2 }); // 1~29
// => 18
Optionally specify min, max, or both to limit the range.
randomDay({ min: 10 });
// => 11
randomDay({ max: 10 });
// => 7
randomDay({ min: 3, max: 9 });
// => 6
Related
random-year - Generate a random year.
random-month - Generate a random 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.