From 493081254d38af44ad12021d3dcca53e3e0ccfd8 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 16 Jul 2024 10:11:27 +0200 Subject: [PATCH] feat: improve to set time --- src/components/common/VnInputDate.vue | 4 ++-- src/components/common/VnInputTime.vue | 26 +++++++++++++++++++++++--- src/pages/Order/OrderLines.vue | 2 -- src/pages/Order/OrderList.vue | 1 - 4 files changed, 25 insertions(+), 8 deletions(-) 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 @@