fix(calculateDurationYmd):moment(endDate).startOf("day").add(1, "days");
Some checks failed
Build & Deploy on Dev / build (push) Has been cancelled

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-01-22 16:45:43 +07:00
parent 8e1e5044c7
commit 15fcfe8054
2 changed files with 3 additions and 1 deletions

View file

@ -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;

View file

@ -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];