The worst way to select a date - now as a driving game!
This is a genuine web component that you can use in your own projects! Simply include the JavaScript file and use the custom element in your HTML.
<!-- Include the component -->
<script src="epoch-express.js"></script>
<!-- Use it anywhere in your HTML -->
<epoch-express />
<!-- Listen for date selection -->
<script>
const picker = document.querySelector('epoch-express');
picker.addEventListener('dateselected', (e) => {
console.log('Selected date:', e.detail.date);
});
</script>
// Get the selected date
const date = document.getElementById('datePicker').value;
// Listen for date changes (fires every 0.5 seconds while driving)
datePicker.addEventListener('dateselected', (e) => {
console.log('Selected date:', e.detail.date);
console.log('Timestamp:', e.detail.timestamp);
});
// Reset the game
datePicker.reset();
// Select current date immediately (bypasses update interval)
datePicker.selectCurrentDate();
<epoch-express
days-per-second="350"
update-interval="500"
car-color="#bada55"
difficulty="normal"
></epoch-express>