mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Add functionality to automatically adjust end date for new calendar events to 1 hr after the start date
This commit is contained in:
@@ -160,4 +160,29 @@ while($row = mysqli_fetch_array($sql)){
|
||||
calendar.render();
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<!-- Automatically set new event end date to 1 hr after start date -->
|
||||
<script>
|
||||
|
||||
// Function - called when user leaves field (onblur)
|
||||
function updateIncrementEndTime() {
|
||||
|
||||
// Get the start date
|
||||
let start = document.getElementById("event_add_start").value;
|
||||
|
||||
// Create a date object
|
||||
let new_end = new Date(start);
|
||||
|
||||
// Set the end date to 1 hr in the future
|
||||
new_end.setHours(new_end.getHours() + 1)
|
||||
|
||||
// Get the date back as a string, with the milliseconds trimmed off
|
||||
new_end = new_end.toISOString().replace(/.\d+Z$/g, "");
|
||||
|
||||
// Update the end date field
|
||||
document.getElementById("event_add_end").value = new_end;
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user