-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
36 lines (32 loc) · 859 Bytes
/
script.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 timeDisplayEl = $('#time-display');
var saveBtn = $('.saveBtn')
//day.js time display
function displayTime() {
var rightNow = dayjs().format('YYYY MMMM DD');
timeDisplayEl.text(rightNow)
};
//shows local storage
function readEventFromStorage() {
var event = localStorage.getItem('event');
if (event) {
event = JSON.parse(event);
} else {
event = [];
}
return event;
}
//saves local storage
function saveEventToStorage(event) {
localStorage.setItem('event', JSON.stringify(event));
}
function printEventData() {
eventDisplayEl.empty();
var event = readEventFromStorage();
rowEl.append(nameEL, typeEl, dateEl, deleteEl);
eventDisplayEl.append(rowEl);
}
//utilizes save button
saveBtn.on('click', saveEventToStorage);
//displays time from day.js
displayTime();
setInterval(displayTime, 1000);