This commit is contained in:
parent
36846164bd
commit
ca666c9ef8
8 changed files with 559 additions and 138 deletions
frontend/src/mixins
|
@ -14,18 +14,22 @@ export default {
|
|||
newValue?: LocationQuery,
|
||||
oldValue?: LocationQuery,
|
||||
}): boolean {
|
||||
return !_.isEqual(
|
||||
{
|
||||
...(oldValue || {}),
|
||||
startDate: this.normalizeDate(oldValue?.startDate),
|
||||
endDate: this.normalizeDate(oldValue?.endDate),
|
||||
},
|
||||
{
|
||||
...(newValue || {}),
|
||||
startDate: this.normalizeDate(newValue?.startDate),
|
||||
endDate: this.normalizeDate(newValue?.endDate),
|
||||
}
|
||||
const values = [oldValue, newValue].map((value) =>
|
||||
Object.entries(value || {}).reduce((acc, [key, val]) => {
|
||||
// Replace all undefined values with null to avoid the comparison from breaking
|
||||
// when an attribute is not set and it's undefined on one side and null on the other
|
||||
acc[key] = val === undefined ? null : val
|
||||
|
||||
// Normalize dates to avoid issues with different date formats
|
||||
if (key === 'startDate' || key === 'endDate') {
|
||||
acc[key] = this.normalizeDate(val)
|
||||
}
|
||||
|
||||
return acc
|
||||
}, {} as Record<string, any>)
|
||||
)
|
||||
|
||||
return !_.isEqual(values[0], values[1])
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue