/**
* 生成指定范围日期的随机日期
* @params {Date} startDate
* @params {Date} endDate
*/
function randomDate(startDate,endDate){
let date = new Date(+startDate + Math.random() * (endDate - startDate));
let hour = 0 + Math.random() * (23 - 0) | 0;
let minute = 0 + Math.random() * (59 - 0) | 0;
let second = 0 + Math.random() * (59 - 0) | 0;
date.setHours(hour);
date.setMinutes(minute);
date.setSeconds(second);
return date;
};
console.log(randomDate(new Date(Date.now()- 24*60*60*1000).getTime(),Date.now()))
console