init commit
This commit is contained in:
43
index.html
Normal file
43
index.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Days since Tommy last drank Alcohol</title>
|
||||
<meta name="description" content="Days since Tommy last drank Alcohol">
|
||||
|
||||
<style type="text/css">
|
||||
html, body {height: 100%;}
|
||||
body {text-align: center;}
|
||||
#answer {
|
||||
display: inline-block;
|
||||
margin-top: 200px;
|
||||
font-weight: bold;
|
||||
font-size: 60pt;
|
||||
font-family: Arial, sans-serif;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="answer" target="_blank"></div>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var calculate = function(){
|
||||
var start = moment("2015-07-02"),
|
||||
end = moment(),
|
||||
diff = end - start,
|
||||
duration = moment.duration(diff);
|
||||
var answer = duration.years() + " Years " + duration.days() + " Days " + duration.hours() + " Hours " + duration.minutes() + " Minutes " + duration.seconds() + " Seconds";
|
||||
var elem = document.getElementById('answer');
|
||||
elem.innerHTML = answer;
|
||||
}
|
||||
window.setInterval(function(){
|
||||
calculate();
|
||||
}, 1000);
|
||||
calculate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user