diff --git a/src/modules/03_recruiting/components/Career.vue b/src/modules/03_recruiting/components/Career.vue index 20c9f86c3..ba1ae035b 100644 --- a/src/modules/03_recruiting/components/Career.vue +++ b/src/modules/03_recruiting/components/Career.vue @@ -181,7 +181,12 @@ lazy-rules :borderless="!edit" :model-value="date2Thai(startDate)" - :rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่ม'}`]" + :rules="[ + (val) => !!val || `${'กรุณาเลือกวันที่เริ่ม'}`, + (val) => + startDate <= endDate || + `${'กรุณาเลือกวันที่เริ่มให้ถูกต้อง'}`, + ]" hide-bottom-space :label="`${'วันที่เริ่ม'}`" > @@ -228,7 +233,9 @@ :model-value="date2Thai(endDate)" :rules="[ (val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`, - endDateValidation, + (val) => + startDate <= endDate || + `${'กรุณาเลือกวันที่สิ้นสุดให้ถูกต้อง'}`, ]" hide-bottom-space :label="`${'วันที่สิ้นสุด'}`" @@ -664,14 +671,6 @@ const checkDelete = (row: RequestItemsObject) => { ); }; -//validat enddate -const endDateValidation = (value: Date) => { - if (startDate.value < endDate.value) { - return true; - } - return false; -}; - /** * ลบข้อมูลใน table */ @@ -832,6 +831,7 @@ const addRow = () => { * เช็คว่ามีการแก้ไขข้อมูล */ const clickEditRow = () => { + myForm.value.validate(); editRow.value = true; };