-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
34 lines (32 loc) · 1.26 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Date Selector</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/luxon/3.3.0/luxon.min.js"></script>
<style>
body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
#calendar { text-align: center; }
button { margin-top: 10px; padding: 5px 10px; }
</style>
</head>
<body>
<div id="calendar">
<input type="date" id="datePicker">
<br>
<button id="copyButton">Copy POSIX Timestamp</button>
</div>
<script>
const datePicker = document.getElementById('datePicker');
const copyButton = document.getElementById('copyButton');
copyButton.addEventListener('click', () => {
const selectedDate = luxon.DateTime.fromISO(datePicker.value);
const posixTimestamp = selectedDate.toSeconds();
navigator.clipboard.writeText(posixTimestamp.toString())
.then(() => alert('POSIX timestamp copied to clipboard!'))
.catch(err => console.error('Error copying text: ', err));
});
</script>
</body>
</html>