random-month

1.0.1 • Public • Published

random-month

Generate a random month.

MIT License

build:? coverage:?

Install

$ npm install --save random-month 

Usage

var randomMonth = require('random-month');
  
// API
// - randomMonth([options]);
  
// options
// - raw
// - min
// - max

By default, returns just the month number from 1 to 12.

randomMonth();
// => 10

Optionally specify raw to get the whole month object:

randomMonth({ raw: true });
// => {name: 'October', short: 'Oct', number: 10, days: 31}

Optionally specify min, max, or both to limit the range.

randomMonth({ min: 10 });
// => 11

randomMonth({ max: 10 });
// => 7

randomMonth({ min: 3, max: 9 });
// => 6

Related

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

Package Sidebar

Install

npm i random-month

Weekly Downloads

1,784

Version

1.0.1

License

MIT

Last publish

Collaborators

  • bubkoo