Skip to content

Instantly share code, notes, and snippets.

@aloyr
Last active November 12, 2020 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aloyr/d531315a6f4ed0ad7d6476dc32b39c2b to your computer and use it in GitHub Desktop.
Save aloyr/d531315a6f4ed0ad7d6476dc32b39c2b to your computer and use it in GitHub Desktop.
get sprint dates
(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