fix: date change
This commit is contained in:
parent
e6e12ccea5
commit
b808d6bd5b
1 changed files with 8 additions and 14 deletions
|
|
@ -231,22 +231,16 @@ defineProps<{
|
|||
"
|
||||
@update:model-value="
|
||||
(v) => {
|
||||
if (v && v.toString().length === 10) {
|
||||
if (editable && v && v.toString().length === 10) {
|
||||
const _date = parseAndFormatDate(v, $i18n.locale);
|
||||
if (_date !== undefined) {
|
||||
if (_date === null)
|
||||
return (item.registerDate = null);
|
||||
const isoDateOld =
|
||||
item.registerDate?.toISOString() ||
|
||||
new Date().toISOString();
|
||||
const isoDateNew = _date?.toISOString();
|
||||
console.log(isoDateOld, isoDateNew);
|
||||
|
||||
item.registerDate = new Date(
|
||||
isoDateNew.split('T')[0] +
|
||||
'T' +
|
||||
isoDateOld.split('T')[1],
|
||||
if (_date) {
|
||||
item.registerDate?.setDate(_date.getDate());
|
||||
item.registerDate?.setMonth(_date.getMonth());
|
||||
item.registerDate?.setFullYear(
|
||||
_date.getFullYear(),
|
||||
);
|
||||
} else {
|
||||
item.registerDate = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue