เพิ่มข้อมูล "อายุราชการ (กทม.)" #2285
All checks were successful
Build & Deploy on Dev / build (push) Successful in 49s

This commit is contained in:
harid 2026-02-06 14:47:47 +07:00
parent 5b726e69c8
commit 1696890f74
3 changed files with 10 additions and 2 deletions

View file

@ -44,7 +44,7 @@ export function calculateAge(start: Date, end = new Date()) {
return { year, month, day };
}
export async function calculateGovAge(profileId: string, type: string) {
export async function calculateGovAge(profileId: string, type: string, bkk?: boolean) {
// type = OFFICER , EMPLOYEE
const isEmployee = type === "EMPLOYEE";
@ -107,7 +107,9 @@ export async function calculateGovAge(profileId: string, type: string) {
});
}
// const firstStartDate = new Date(records[0].date);
const firstStartDate = profile?.dateAppoint ? profile?.dateAppoint : new Date();
const firstStartDate = !bkk
? profile?.dateAppoint ? profile?.dateAppoint : new Date()
: profile?.dateStart ? profile?.dateStart : new Date() ;
const firstEndDate = endDateFristRec ? new Date(endDateFristRec.dateGovernment) : new Date();
// console.log("firstStartDate1", firstStartDate);