Last active
November 12, 2020 16:23
-
-
Save aloyr/d531315a6f4ed0ad7d6476dc32b39c2b to your computer and use it in GitHub Desktop.
get sprint dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
const startDay = new Date('01/04/2021'); | |
let currentDay = new Date(startDay.getTime()); | |
let sprintNo = 1; | |
while (currentDay.getYear() == startDay.getYear()) { | |
let endDay = new Date(currentDay.getTime()); | |
endDay.setDate(endDay.getDate() + 11); | |
console.log(fSprint(sprintNo++), fDate(currentDay), fDate(endDay)); | |
currentDay.setDate(currentDay.getDate() + 14); | |
} | |
function fSprint(sprint) { | |
const sprintNo = (sprint + 100).toString().substring(1); | |
return `2021-${sprintNo}`; | |
} | |
function fDate(date) { | |
const day = (date.getDate() + 100).toString().substring(1); | |
const month = (date.getMonth() + 101).toString().substring(1); | |
const year = date.getFullYear().toString(); | |
return `${year}-${month}-${day}`; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment