diff --git a/src/modules/04_registry/components/Education.vue b/src/modules/04_registry/components/Education.vue
index 137a7b717..8fc65b82f 100644
--- a/src/modules/04_registry/components/Education.vue
+++ b/src/modules/04_registry/components/Education.vue
@@ -1755,7 +1755,11 @@ watch(
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
- finishDate.value = dateVal.value;
+ if (dateVal.isValid) {
+ finishDate.value = dateVal.value;
+ } else {
+ finishDateInput.value = "";
+ }
}
}
diff --git a/src/modules/04_registry/components/Insignia.vue b/src/modules/04_registry/components/Insignia.vue
index 9cdd3d22a..0b4a8d658 100644
--- a/src/modules/04_registry/components/Insignia.vue
+++ b/src/modules/04_registry/components/Insignia.vue
@@ -1457,9 +1457,13 @@ watch(
() => dateAnnounceInput.value,
(value: string) => {
if (value.length === 10) {
+
const dateVal = convertDate(value);
- dateAnnounce.value = dateVal.value;
- console.log(dateAnnounce.value);
+ if (dateVal.isValid) {
+ dateAnnounce.value = dateVal.value;
+ } else {
+ dateAnnounceInput.value = "";
+ }
}
}
);
@@ -1468,7 +1472,11 @@ watch(
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
- refCommandDate.value = dateVal.value;
+ if (dateVal.isValid) {
+ refCommandDate.value = dateVal.value;
+ } else {
+ refCommandDateInput.value = "";
+ }
}
}
);
diff --git a/src/modules/04_registry/components/Train.vue b/src/modules/04_registry/components/Train.vue
index 8a0354b93..4d74f6a40 100644
--- a/src/modules/04_registry/components/Train.vue
+++ b/src/modules/04_registry/components/Train.vue
@@ -389,7 +389,7 @@
dense
/>
("true");
const mixin = useCounterMixin();
-const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader,convertDate,convertDateDisplay } =
- mixin;
+const {
+ date2Thai,
+ success,
+ dateToISO,
+ messageError,
+ showLoader,
+ hideLoader,
+ convertDate,
+ convertDateDisplay,
+} = mixin;
const route = useRoute();
const id = ref("");
const name = ref();
@@ -668,7 +676,7 @@ const place = ref();
const duration = ref();
const department = ref();
const numberOrder = ref();
-const dateOrder = ref(new Date());
+const dateOrder = ref(new Date());
const startDate = ref(new Date().getFullYear());
const startDate2 = ref(new Date());
const endDate = ref(new Date().getFullYear());
@@ -1064,7 +1072,7 @@ const getData = () => {
yearlyInput.value = (Number(row.yearly) + 543).toLocaleString();
inputStartDate2.value = convertDateDisplay(row.startDate2);
inputEndDate2.value = convertDateDisplay(row.endDate2);
- dateOrderInput.value = row.dateOrder ? convertDateDisplay(row.dateOrder):'';
+ dateOrderInput.value = row.dateOrder ? convertDateDisplay(row.dateOrder) : "";
};
/**
@@ -1102,7 +1110,7 @@ const clickAdd = async () => {
/**
* กดบันทึกใน dialog
*/
- const clickSave = async () => {
+const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
if (isDate.value == "false") {
@@ -1283,7 +1291,7 @@ const selectData = async (props: DataProps) => {
name.value = props.row.name;
topic.value = props.row.topic;
yearly.value = props.row.yearly;
- console.log(typeof yearly.value)
+ console.log(typeof yearly.value);
place.value = props.row.place;
duration.value = props.row.duration;
department.value = props.row.department;
@@ -1296,10 +1304,15 @@ const selectData = async (props: DataProps) => {
endDate2.value = props.row.endDate2;
inputStartDate.value = (Number(props.row.startDate) + 543).toLocaleString();
inputEndDate.value = (Number(props.row.endDate) + 543).toLocaleString();
- yearlyInput.value = props.row.yearly !== 0 ? (Number(props.row.yearly) + 543).toLocaleString():'';
+ yearlyInput.value =
+ props.row.yearly !== 0
+ ? (Number(props.row.yearly) + 543).toLocaleString()
+ : "";
inputStartDate2.value = convertDateDisplay(props.row.startDate2);
inputEndDate2.value = convertDateDisplay(props.row.endDate2);
- dateOrderInput.value = props.row.dateOrder ? convertDateDisplay(props.row.dateOrder):'';
+ dateOrderInput.value = props.row.dateOrder
+ ? convertDateDisplay(props.row.dateOrder)
+ : "";
id.value = props.row.id;
await checkRowPage();
};
@@ -1461,8 +1474,11 @@ watch(
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
+ if (dateVal.isValid) {
dateOrder.value = dateVal.value;
-
+ } else {
+ dateOrderInput.value = "";
+ }
}
}
);