From 2ef4a8c5de610f0a88f708c5c7eb27e7257c68e6 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 16 Apr 2025 11:42:58 +0200 Subject: [PATCH] fix: refs #8647 fixed inputDateTime modelValue warning --- src/components/common/VnInputDateTime.vue | 2 +- src/components/common/__tests__/VnInputDateTime.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/VnInputDateTime.vue b/src/components/common/VnInputDateTime.vue index 41269bf4b..67d1793b1 100644 --- a/src/components/common/VnInputDateTime.vue +++ b/src/components/common/VnInputDateTime.vue @@ -29,7 +29,7 @@ const styleAttrs = computed(() => { const mask = 'DD-MM-YYYY HH:mm'; const selectedDate = computed({ get() { - if (!model.value) return new Date(model.value); + if (!model.value) return JSON.stringify(new Date(model.value)); return date.formatDate(new Date(model.value), mask); }, set(value) { diff --git a/src/components/common/__tests__/VnInputDateTime.spec.js b/src/components/common/__tests__/VnInputDateTime.spec.js index 23132d77d..adff1dbc4 100644 --- a/src/components/common/__tests__/VnInputDateTime.spec.js +++ b/src/components/common/__tests__/VnInputDateTime.spec.js @@ -33,7 +33,7 @@ describe('VnInputDateTime', () => { it('handles null date value', async () => { generateWrapper(null, false, true); await vm.$nextTick(); - expect(vm.selectedDate).toBeInstanceOf(Date); + expect(vm.selectedDate).not.toBe(null); }); it('updates the model value when a new datetime is set', async () => {