From 9103532fed1d65b61ba49c396bc0aeb220a502da Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 11 Mar 2025 10:10:35 +0700 Subject: [PATCH] convertDatetime --- src/components/FormTime.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/FormTime.vue b/src/components/FormTime.vue index e433642..33e91a7 100644 --- a/src/components/FormTime.vue +++ b/src/components/FormTime.vue @@ -19,6 +19,8 @@ const { showLoader, hideLoader, messageError, + convertDateToAPI, + convertDatetimeToAPI, } = useCounterMixin() /** @@ -43,7 +45,7 @@ const props = defineProps({ }) const dataByIdVal = ref() //ข้อมูลประวัติการลงเวลา -const date = ref(new Date()) //วันที่ข้อแก้ไข +const date = ref(new Date()) //วันที่ข้อแก้ไข const checkboxIn = ref(false) //ขอแก้ไขเวลาเข้างาน const checkboxOut = ref(false) //ขอแก้ไขเวลาออกงาน const reason = ref('') // เหตุผล @@ -92,7 +94,7 @@ function onCkickSave() { ) { dialogConfirm($q, async () => { const data: FormTimeStemp = { - checkDate: date.value, + checkDate: convertDatetimeToAPI(date.value as Date), checkInEdit: checkboxIn.value, checkOutEdit: checkboxOut.value, description: reason.value, @@ -149,9 +151,7 @@ onMounted(() => { if (dataByIdVal.value == null) { statusAction.value = true } else { - date.value = moment(new Date(dataByIdVal.value.checkInDateTime)).format( - 'YYYY-MM-DD' - ) + date.value = convertDatetimeToAPI(new Date(dataByIdVal.value.checkInDateTime)) } })