-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
56 lines (43 loc) · 1.46 KB
/
app.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
let people = document.getElementById('people');
let people_less = document.getElementById('people_less');
let people_more = document.getElementById('people_more');
let people_index = 4;
people_less.addEventListener('click', () => {
people_index -= 1;
if (people_index <= 0) {
people_index = 1;
people.value = people_index + ' People';
} else {
people.value = people_index + ' People';
}
})
people_more.addEventListener('click', () => {
people_index += 1;
if (people_index >= 4) {
people_index = 4;
people.value = people_index + ' People';
} else {
people.value = people_index + ' People';
}
})
let checkin_data = document.getElementById('checkin_data');
let checkin = document.getElementById('checkin');
checkin.addEventListener('change', () => {
let checkin_value = checkin.value;
// console.log(checkin_value);
let dates = new Date(checkin_value);
let dates2 = new Date();
const week = ['Sun', 'Mon', 'Thu', 'Wed', 'Thu', 'Fri', 'Sat']
let day = week[dates.getDay()];
// console.log(day)
let date = checkin_value.slice(8, 10);
// console.log(date);
let months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
let month = months[dates.getMonth()];
// console.log(month);
if (dates < dates2) {
console.log('No Date');
} else {
checkin_data.innerText = day + ', ' + date + ' ' + month;
}
})