diff --git a/src/interfaces/utils.ts b/src/interfaces/utils.ts index 596f53c5..7ab5583f 100644 --- a/src/interfaces/utils.ts +++ b/src/interfaces/utils.ts @@ -141,8 +141,8 @@ export async function calculateGovAge(profileId: string, type: string) { if (current.isGovernment === true) { const startDate = new Date(current.dateGovernment); const endDate = next ? new Date(next.dateGovernment) : new Date(); - - const { years, months, days } = calculateDuration(startDate, endDate); + const adjustedEndDate = new Date(endDate.getTime() + 86400000) //เพิ่ม 1 วัน (วันปัจจุบัน) + const { years, months, days } = calculateDuration(startDate, adjustedEndDate); totalYears2 += years; totalMonths2 += months;