-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.html
43 lines (38 loc) · 1.15 KB
/
sidebar.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<label for="from">Start date:</label>
<input type="date" id="start" name="start">
<br>
<label for="to">End date:</label>
<input type="date" id="end" name="end">
<br>
<button onclick="validateData()" type="button">📅Submit date📅</button>
</body>
<script>
let start = document.getElementById("start");
let end = document.getElementById("end");
let today = new Date();
let daysAgo = new Date(today - 86400000);
end.value = today.toISOString().substring(0,10);
start.max = today.toISOString().substring(0,10);
/*
end.addEventListener('change', (event) => {start.max = event.target.value});
*/
function validateData() {
if(start.value > end.value || !start.value || !end.value) {
alert("You're missing a value or the start date is before the end date");
} else {
google.script.run.withSuccessHandler(closeModal).onCall(start.value,end.value);
}
}
function closeModal(success = false) {
if(success) {
google.script.host.close();
}
}
</script>
</html>