1
0
mirror of https://github.com/osmarks/website synced 2024-12-25 01:20:33 +00:00
website/experiments/joe/index.html
2020-03-08 17:13:14 +00:00

27 lines
624 B
HTML

---
title: JHLT
description: Tells you how late Joe's homework is.
---
<div id="timer"></div>
<script src="/assets/js/moment.min.js"></script>
<script>
var joe = moment("2017-03-23T09:15:00");
var el = document.getElementById("timer");
function format(dur) {
return "Joe's homework is " +
+ dur.years() + " years "
+ dur.months() + " months "
+ dur.days() + " days "
+ dur.hours() + " hours "
+ dur.minutes() + " minutes "
+ dur.seconds() + " seconds late.";
}
setInterval(function() {
var diff = moment.duration(-joe.diff(moment()));
el.innerText = format(diff);
}, 1000);
</script>