forked from AriLFrankel/MomentJS-Age-Clock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
27 lines (27 loc) · 956 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!Doctype HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Birthday Countdown</title>
<link rel="stylesheet" href="style.css">
<!--Expose Moment.js and moment-precise-range-plugin to this file-->
<script type="text/javascript" src="./node_modules/moment/moment.js"></script>
<script type="text/javascript" src="./node_modules/moment-precise-range-plugin/moment-precise-range.js"></script>
</head>
<body>
<div class="countdown"></div>
<script type="text/javascript">
window.birthday = prompt('What is your birthday? MM/DD/YYYY')
// invoke displayAge once
displayAge()
// invoke displayAge on an interval once a second
setInterval(displayAge, 1000)
function displayAge(){
/*
Use moment() to create a new moment object from the present time
Fix this function to display someone's exact age
*/
document.querySelector('.countdown').innerHTML = moment()
}
</script>
</body>