forked from lamplightdev/aeon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
es5.html
112 lines (101 loc) · 2.99 KB
/
es5.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html lang="en">
<head>
<title>Aeon Date Picker (ES5)</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
font-size: 16px;
font-family: sans-serif;
}
input {
font-size: inherit;
font-family: inherit;
padding: 0.3rem;
}
form {
margin-bottom: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid #eee;
}
:root {
--aeon-rgb: 170, 10, 10;
}
</style>
<script
crossorigin="anonymous"
src="https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.find%2CArray.prototype.includes%2CString.prototype.padStart"
></script>
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@%5E2/webcomponents-loader.js"></script>
<script>
window.WebComponents = window.WebComponents || {
waitFor: function(cb) {
addEventListener('WebComponentsReady', cb);
}
};
WebComponents.waitFor(function() {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.src = './dist/aeon-es5.js';
head.appendChild(script);
window.ShadyCSS &&
window.ShadyCSS.styleDocument({ '--aeon-rgb': '170, 10, 10' });
});
</script>
</head>
<body>
<h1>
Aeon Date Picker (ES5)
</h1>
<form>
<p>
<label for="date-start">Start Date</label>
<aeon-datepicker default-date="2020-01-01" default-time="09:30">
<input
id="date-start"
name="date-start"
type="date"
value="2020-04-06"
placeholder="Start date"
/>
<input id="time-start" type="time" value="12:00" />
</aeon-datepicker>
</p>
<p>
<label for="date-end">End Date</label>
<aeon-datepicker default-date="2025-01-01" default-time="17:00">
<input
id="date-end"
name="date-end"
type="date"
placeholder="End date"
/>
<input id="time-end" type="time" />
</aeon-datepicker>
</p>
<button>
Go
</button>
</form>
<div id="output">
<p>Start date: <span id="output-start"></span></p>
<p>End date: <span id="output-end"></span></p>
</div>
<script>
const form = document.querySelector('form');
form.addEventListener('submit', function(event) {
event.preventDefault();
document.querySelector('#output-start').innerHTML =
form.querySelector('#date-start').value +
' ' +
form.querySelector('#time-start').value;
document.querySelector('#output-end').innerHTML =
form.querySelector('#date-end').value +
' ' +
form.querySelector('#time-end').value;
});
</script>
</body>
</html>