mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
Fix datetime switch between operators [SCI-6571] (#3888)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
parent
91ab7d0b40
commit
cf200a23a7
1 changed files with 18 additions and 14 deletions
|
@ -11,6 +11,9 @@ export default {
|
|||
if(this.isPreset) {
|
||||
this.date = null;
|
||||
this.dateTo = null;
|
||||
this.value = {}
|
||||
} else {
|
||||
this.updateValue();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -33,10 +36,10 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
rangeObject(start, end) {
|
||||
let range = {};
|
||||
const range = {};
|
||||
|
||||
range['start_' + this.timeType] = start;
|
||||
range['end_' + this.timeType] = end;
|
||||
range[`start_${this.timeType}`] = this.formattedDate(start);
|
||||
range[`end_${this.timeType}`] = this.formattedDate(end);
|
||||
|
||||
return range;
|
||||
},
|
||||
|
@ -48,21 +51,22 @@ export default {
|
|||
return tz;
|
||||
},
|
||||
updateDate(date) {
|
||||
date = date && this.formattedDate(date);
|
||||
this.date = date;
|
||||
if (this.dateTo) {
|
||||
this.value = this.rangeObject(date, this.dateTo);
|
||||
} else {
|
||||
let valueObject = {};
|
||||
valueObject[this.timeType] = date;
|
||||
|
||||
this.value = valueObject;
|
||||
}
|
||||
this.updateValue();
|
||||
},
|
||||
updateDateTo(date) {
|
||||
date = date && this.formattedDate(date);
|
||||
this.dateTo = date;
|
||||
this.value = this.rangeObject(this.date, date);
|
||||
this.updateValue();
|
||||
},
|
||||
|
||||
updateValue() {
|
||||
if (this.dateTo) {
|
||||
this.value = this.rangeObject(this.date, this.dateTo);
|
||||
} else {
|
||||
const valueObject = {};
|
||||
valueObject[this.timeType] = this.formattedDate(this.date);
|
||||
this.value = valueObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue