From 4943cbec09ebcc9db36d0741f3d6a8fe94090655 Mon Sep 17 00:00:00 2001 From: Dede Fuji Abdul Date: Sun, 7 Apr 2024 04:53:55 +0700 Subject: [PATCH] Refactor dateValue initialization in DatePicker.vue --- src/components/DatePicker.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue index 365d8d8..6057725 100755 --- a/src/components/DatePicker.vue +++ b/src/components/DatePicker.vue @@ -4,7 +4,7 @@ import { onMounted, ref, watch } from 'vue' import VueTailwindDatepicker from 'vue-tailwind-datepicker' const dateValue = ref( - `${new Date().getDay().toString().length == 1 ? `0${new Date().getDay()}` : new Date().getDay()}-${(new Date().getMonth() + 1).toString().length == 1 ? `0${new Date().getMonth() + 1}` : new Date().getMonth() + 1}-${new Date().getFullYear()} s/d ${new Date().getDay().toString().length == 1 ? `0${new Date().getDay()}` : new Date().getDay()}-${(new Date().getMonth() + 1).toString().length == 1 ? `0${new Date().getMonth() + 1}` : new Date().getMonth() + 1}-${new Date().getFullYear()}` + `${new Date().getDate().toString().length == 1 ? `0${new Date().getDate()}` : new Date().getDate()}-${(new Date().getMonth() + 1).toString().length == 1 ? `0${new Date().getMonth() + 1}` : new Date().getMonth() + 1}-${new Date().getFullYear()} s/d ${new Date().getDate().toString().length == 1 ? `0${new Date().getDate()}` : new Date().getDate()}-${(new Date().getMonth() + 1).toString().length == 1 ? `0${new Date().getMonth() + 1}` : new Date().getMonth() + 1}-${new Date().getFullYear()}` ) const formatter = ref({ date: 'DD-MM-YYYY', @@ -79,6 +79,7 @@ watch(dateValue, (newValue) => { onMounted(() => { emit('update:dateValue', dateValue.value) + console.log('current date', dateValue.value) })