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,
hideLoader,
messageError,
convertDateToAPI,
convertDatetimeToAPI,
} = useCounterMixin()
/**
@ -43,7 +45,7 @@ const props = defineProps({
})
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 checkboxOut = ref<boolean>(false) //
const reason = ref<string>('') //
@ -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))
}
})
</script>