Files
SupportBot/node_modules/chance/docs/time/year.md
T
2021-02-02 13:50:53 +00:00

459 B

year

// usage
chance.year()
chance.year({min: 1900, max: 2100})

Generate a random year

chance.year();
=> '2053'

By default, min is the current year and max is 100 years greater than min.

This is returned as a string. If for some reason you need it numeric, just parse it:

parseInt(chance.year());
=> 2042

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

chance.year({min: 1900, max: 2100});
=> '1983'