-
Notifications
You must be signed in to change notification settings - Fork 0
/
clock.js
36 lines (28 loc) · 835 Bytes
/
clock.js
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
28
29
30
31
32
33
34
35
36
/*
var wakeUpTime = 7;
var midDay = 12;
var evening = 18;
var currentTime = document.getElementById("#time");
var moodT = document.getElementById("#mood");
var buttony = document.getElementById("click");
buttony.addEventListener("click", function () {
return new Date().toLocaleTimeString();
});*/
const item = document.getElementById('time');
const moood = document.getElementById("mood");
const value = item.nodeValue;
let tim = new Date().getHours();
let tiime = new Date().toLocaleTimeString();
/*console.log(value);*/
item.innerText = item.childNodes[0].nodeValue + tiime;
if(tim < 12 ) {
moood.innerText = " it's morning";
}
else {
if( tim < 18) {
moood.innerText = " it's afternoon";
}
else{
moood.innerText = " it's evening";
}
}