diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index d8f41349a..6e57a8a53 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -54,8 +54,8 @@ const formattedDate = computed({ ); } } - let ymd = value.split('-').map((e) => parseInt(e)); - newDate = new Date(ymd[0], ymd[1] - 1, ymd[2]); + const [year, month, day] = value.split('-').map((e) => parseInt(e)); + newDate = new Date(year, month - 1, day); if (model.value) { const orgDate = model.value instanceof Date ? model.value : new Date(model.value); diff --git a/src/components/common/VnInputTime.vue b/src/components/common/VnInputTime.vue index a6c7f1db5..0971facf9 100644 --- a/src/components/common/VnInputTime.vue +++ b/src/components/common/VnInputTime.vue @@ -1,5 +1,5 @@