random-hour
v1.0.3
Published
Generate a random hour.
Downloads
820
Maintainers
Readme
random-hour
Generate a random hour.
Install
$ npm install --save random-hour
Usage
var randomHour = require('random-hour');
// API
// - randomHour([options]);
// options
// - twentyFour
// - min
// - max
By default, returns an hour from 1
to 12
for a standard 12-hour clock:
randomHour();
// => 9
Can optionally specify a full twenty-four:
randomHour({ twentyFour: true });
// => 14
Optionally specify min, max, or both to limit the range.
randomHour({ min: 10 });
// => 11
randomHour({ max: 10 });
// => 7
randomHour({ min: 5, max: 10 });
// => 8
Related
- random-year - Generate a random year.
- random-month - Generate a random month.
- random-day - Generate a random day of a month.
- 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.