Pre-prod tweaks
This commit is contained in:
35
web/ppr.html
35
web/ppr.html
@@ -685,9 +685,44 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Set default date and time values
|
||||
function setDefaultDateTime() {
|
||||
const now = new Date();
|
||||
// Round up to the next hour
|
||||
const nextHour = new Date(now);
|
||||
nextHour.setHours(now.getHours() + 1, 0, 0, 0);
|
||||
|
||||
// ETD is 1 hour after ETA
|
||||
const etd = new Date(nextHour);
|
||||
etd.setHours(nextHour.getHours() + 1);
|
||||
|
||||
// Format date and time for separate inputs
|
||||
function formatDate(date) {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
function formatTime(date) {
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
return `${hours}:${minutes}`;
|
||||
}
|
||||
|
||||
// Set ETA to next hour
|
||||
document.getElementById('eta-date').value = formatDate(nextHour);
|
||||
document.getElementById('eta-time').value = formatTime(nextHour);
|
||||
|
||||
// Set ETD to one hour after ETA
|
||||
document.getElementById('etd-date').value = formatDate(etd);
|
||||
document.getElementById('etd-time').value = formatTime(etd);
|
||||
}
|
||||
|
||||
// Initialize the page when DOM is loaded
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
initializeTimeDropdowns();
|
||||
setDefaultDateTime();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user