diff --git a/src/modules/15_development/components/scholarship/DetailView.vue b/src/modules/15_development/components/scholarship/DetailView.vue index 641f10094..7f9e59d08 100644 --- a/src/modules/15_development/components/scholarship/DetailView.vue +++ b/src/modules/15_development/components/scholarship/DetailView.vue @@ -374,6 +374,8 @@ function changeStartDate(type: string) { const endDate = new Date(formBody?.endDate); if (startDate > endDate) { formBody.endDate = null; + } else { + formBody.totalPeriod = calculateDurationYmd(startDate, endDate); } } break; diff --git a/src/stores/mixin.ts b/src/stores/mixin.ts index 4ea752184..7bc422c8b 100644 --- a/src/stores/mixin.ts +++ b/src/stores/mixin.ts @@ -946,7 +946,7 @@ export const useCounterMixin = defineStore("mixin", () => { if (!startDate || !endDate) return ""; let start = moment(startDate).startOf("day"); - let end = moment(endDate).startOf("day"); + let end = moment(endDate).startOf("day").add(1, "days"); // สลับค่าเพื่อให้ end มากกว่า start เสมอ if (start > end) [start, end] = [end, start];