fixed mealplan to date set wrongly when open multiple times

This commit is contained in:
vabene1111 2024-01-08 20:24:23 +08:00
parent 71e5484f0c
commit d493ba72a1

View File

@ -212,7 +212,7 @@ export default {
'entryEditing.from_date': {
handler(newVal, oldVal) {
if (newVal !== undefined && oldVal !== undefined) {
if (newVal !== oldVal) {
if (newVal !== oldVal && newVal !== this.entryEditing.to_date) {
let change = Math.abs(moment(oldVal).diff(moment(this.entryEditing.to_date), 'days')) // even though negative numbers might be correct, they would be illogical as to needs to always be larger than from
this.entryEditing.to_date = moment(newVal).add(change, 'd').format("YYYY-MM-DD")
}