Skip to Content
๐ŸŽฒ Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More

year

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

Generate a random year

randBox.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(randBox.year()); => 2042

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

randBox.year({min: 1900, max: 2100}); => '1983'
Last updated on: