add function formatted date/time to API in mixin

This commit is contained in:
Warunee Tamkoo 2025-03-10 17:07:00 +07:00
parent 197b621436
commit 126fbdbed1
2 changed files with 20 additions and 7 deletions

View file

@ -1,7 +1,6 @@
<script setup lang="ts">
import { ref, reactive, watch, onMounted } from "vue";
import { useQuasar } from "quasar";
import { format, utcToZonedTime } from "date-fns-tz";
import http from "@/plugins/http";
import config from "@/app.config";
@ -25,6 +24,7 @@ const {
showLoader,
hideLoader,
success,
convertDateToAPI,
} = mixin;
const emit = defineEmits(["update:change-page"]);
@ -113,12 +113,7 @@ function onSubmit() {
/** Function เปลี่ยนรอบเวลา*/
async function changeRound() {
const formattedDateForAPI = await (formData.effectiveDate
? format(
utcToZonedTime(formData.effectiveDate, "Asia/Bangkok"),
"yyyy-MM-dd"
)
: null);
const formattedDateForAPI = await convertDateToAPI(formData.effectiveDate);
showLoader();
await http