mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-07 20:40:26 +08:00
Add validation for date picker [SCI-6541] (#3875)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
parent
cce6a17e8f
commit
ed5b69c0ab
2 changed files with 11 additions and 8 deletions
|
@ -28,7 +28,7 @@
|
|||
},
|
||||
methods: {
|
||||
update(value) {
|
||||
this.$emit('change', value.toDate());
|
||||
this.$emit('change', (value instanceof Date) ? value.toDate() : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,15 +53,18 @@
|
|||
},
|
||||
recalcTimestamp() {
|
||||
let date = this.timeOnly ? new Date() : this.date;
|
||||
if (!this.isValidTime()) {
|
||||
date.setHours(0);
|
||||
date.setMinutes(0);
|
||||
if (this.isValidDate(date)) {
|
||||
if (!this.isValidTime()) {
|
||||
date.setHours(0);
|
||||
date.setMinutes(0);
|
||||
} else {
|
||||
date.setHours(this.time.split(':')[0]);
|
||||
date.setMinutes(this.time.split(':')[1]);
|
||||
}
|
||||
this.datetime = date
|
||||
} else {
|
||||
date.setHours(this.time.split(':')[0]);
|
||||
date.setMinutes(this.time.split(':')[1]);
|
||||
this.datetime = null;
|
||||
}
|
||||
|
||||
this.datetime = date
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue