fix: if a user edits an event by postponing it, say by a week, without changing the hours, the end date should be recalculate

This commit is contained in:
sedum 2024-01-06 11:27:20 +01:00
parent 0f047a264e
commit 6c2840a7fa

View file

@ -270,6 +270,14 @@ export default {
} else {
let from = value
let due = this.value.due
// if a user edits an event by postponing it, say by a week, without changing the hours, the end date should be recalculate
if (this.value.from) {
let newDueDate = new Date(value).toDateString()
if (this.value.dueHour < this.value.fromHour) {
newDueDate = new Date(DateTime.fromJSDate(from, {zone: this.settings.instance_timezone}).plus({day: 1}).toJSDate()).toDateString()
}
due = new Date(newDueDate + " " + this.value.dueHour)
}
this.$emit('input', { ...this.value, from, due })
}
}