Skip to content

Instantly share code, notes, and snippets.

@nomanHasan
Created November 26, 2017 09:50
Show Gist options
  • Save nomanHasan/07c960e20b6ecc23875b7975ec7e36a0 to your computer and use it in GitHub Desktop.
Save nomanHasan/07c960e20b6ecc23875b7975ec7e36a0 to your computer and use it in GitHub Desktop.
Auto Event Time Generations
getDemoDates = () => {
days = []
for(i = 0; i< 1000; i++){
d = new Date()
dif = Math.random() * 200 - 100
d.setDate(dif)
days.push(d)
}
return days;
}
getDatesByHour = dateBH => {
number = Math.random() * 100
datesBH = [];
for(i =0 ; i <number; i ++){
dBH = dateBH
dBH.setHours(Math.random()*24);
datesBH.push(d)
}
return datesBH
}
getDemoDates().forEach(df => {
dates = dates.concat(getDatesByHour(df))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment