UNPKG

shamjs

Version:
21 lines (20 loc) 501 B
var integer = require('./integer') var _randomDate = function (min, max) { min = min === undefined ? new Date(0) : min max = max === undefined ? new Date() : max if (typeof min !== 'object') { min = new Date(min) } if (typeof max !== 'object') { max = new Date(max) } return new Date( integer( min.getTime(), max.getTime() ) ) } module.exports = function (min, max) { return _randomDate(min, max).getTime() }