Skip to content

Instantly share code, notes, and snippets.

@tomestephens
Created August 1, 2019 17:50
Show Gist options
  • Save tomestephens/18e7682d5130affba8a9cb2319c5261d to your computer and use it in GitHub Desktop.
Save tomestephens/18e7682d5130affba8a9cb2319c5261d to your computer and use it in GitHub Desktop.
We use Letters for our sprint relative to the position in the year - so I made a super simple UI to give you the right letter for a given date.
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script>
const alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
function getSprintLetter() {
const dateStr = document.getElementById("release_date").value
const messageBox = document.getElementById("messageBox")
const date = moment(dateStr, ["MM-DD-YYYY", "YYYY-MM-DD"])
if (isNaN(date.week())) {
messageBox.innerText = "Error parsing date."
} else {
messageBox.innerText = `Sprint letter is ${alphabet[Math.floor(date.week()/2)-1]}!`
}
}
</script>
</head>
<body>
<div class="container">
<div class="row">
<form class="col s12">
<div class="input-field col s9">
<input placeholder="Release Date" id="release_date" type="text">
<label for="release_date">Release Date</label>
<span class="helper-text" id="messageBox"></span>
</div>
<div class="col s3" style="padding-top:20px;">
<a class="waves-effect waves-light btn" onclick="getSprintLetter()"><i class="material-icons right">send</i>Get</a>
</div>
</form>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment