This Gist was generated by Contrived.
Do not modify the metadata file if you want to open in Contrived again. Otherwise, it is safe to delete.
Happy Hacking!
{"user":"5f0c542a4a2ce5e528e01fdf","templateVersion":"1","templateId":"evaljs","resources":[],"dependencies":[],"files":[{"id":1,"parentId":0,"name":"src","path":"/src","type":"folder","isRoot":true,"selected":false,"expanded":true,"children":[{"id":2,"name":"index.js"}]},{"id":2,"parentId":1,"name":"index.js","path":"/src/index.js","type":"file","mimeType":"es6","isRoot":false,"open":true,"selected":true,"content":""}],"experimentId":"5f7b89775556113114e18d8f"} |
/* Gist files cannot be empty */ |
<!-- Gist files cannot be empty --> |
const generateLastYearOfDays = () => { | |
return Array(364).fill(null).map((_, i) => { | |
let day = new Date(); | |
day.setDate(day.getDate() - i); | |
return { | |
date: day, | |
}; | |
}); | |
}; | |
// generateLastYearOfDays(); | |
const generateLastYearOfMonths = () => { | |
const shorts = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
return Array(12).fill(null).map((_, i) => { | |
let month = new Date(); | |
month.setMonth(month.getMonth() - i); | |
return { | |
month, | |
display: shorts[month.getMonth()], | |
}; | |
}); | |
}; | |
// generateLastYearOfMonths(); |