random-day

Generate a random day.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
random-day
001.0.16 years ago6 years agoMinified + gzip package size for random-day in KB

Readme

random-day
Generate a random day.

MIT License
build:? coverage:?

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




Contributing


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