convertDatetime

This commit is contained in:
setthawutttty 2025-03-11 10:10:35 +07:00
parent a58bea37c9
commit 9103532fed

View file

@ -19,6 +19,8 @@ const {
showLoader, showLoader,
hideLoader, hideLoader,
messageError, messageError,
convertDateToAPI,
convertDatetimeToAPI,
} = useCounterMixin() } = useCounterMixin()
/** /**
@ -43,7 +45,7 @@ const props = defineProps({
}) })
const dataByIdVal = ref<DataCheckIn>() // const dataByIdVal = ref<DataCheckIn>() //
const date = ref<Date | string>(new Date()) // const date = ref<Date | string | null>(new Date()) //
const checkboxIn = ref<boolean>(false) // const checkboxIn = ref<boolean>(false) //
const checkboxOut = ref<boolean>(false) // const checkboxOut = ref<boolean>(false) //
const reason = ref<string>('') // const reason = ref<string>('') //
@ -92,7 +94,7 @@ function onCkickSave() {
) { ) {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
const data: FormTimeStemp = { const data: FormTimeStemp = {
checkDate: date.value, checkDate: convertDatetimeToAPI(date.value as Date),
checkInEdit: checkboxIn.value, checkInEdit: checkboxIn.value,
checkOutEdit: checkboxOut.value, checkOutEdit: checkboxOut.value,
description: reason.value, description: reason.value,
@ -149,9 +151,7 @@ onMounted(() => {
if (dataByIdVal.value == null) { if (dataByIdVal.value == null) {
statusAction.value = true statusAction.value = true
} else { } else {
date.value = moment(new Date(dataByIdVal.value.checkInDateTime)).format( date.value = convertDatetimeToAPI(new Date(dataByIdVal.value.checkInDateTime))
'YYYY-MM-DD'
)
} }
}) })
</script> </script>