diff --git a/src/services/RetirementService.ts b/src/services/RetirementService.ts index 7ebfcb17..3e8a1923 100644 --- a/src/services/RetirementService.ts +++ b/src/services/RetirementService.ts @@ -31,7 +31,6 @@ export class RetirementService { }; try { - // หาวันที่ 1 ตุลาคมของปีปัจจุบัน const now = new Date(); const currentYear = now.getFullYear(); @@ -50,7 +49,7 @@ export class RetirementService { }); // Filter เอาเฉพาะวันที่ 1 ตุลาคมเท่านั้น - const filteredProfiles = profiles.filter(p => { + const filteredProfiles = profiles.filter((p) => { if (!p.leaveDate) return false; const leaveDate = new Date(p.leaveDate); return ( @@ -87,11 +86,10 @@ export class RetirementService { }; result.failedProfiles.push(errorInfo); } - }) + }), ); } } - } catch (error: any) { // Log error but don't throw - allow cronjob to complete with partial results console.error("[cronjobPostRetireToExprofile] Error:", error); @@ -118,7 +116,7 @@ export class RetirementService { const retireYear = retireDate.getFullYear(); // Validate date is valid - if (isNaN(retireYear) || retireYear < 2000 || retireYear > 2100) { + if (isNaN(retireYear) || retireYear < 2000) { throw new Error(`Invalid leaveDate for profile ${profile.id}: ${profile.leaveDate}`); } @@ -135,7 +133,7 @@ export class RetirementService { profile.posLevel?.posLevelName || "", retireDate, profile.org || "", - profile.leaveReason || "เกษียณอายุราชการ" + profile.leaveReason || "เกษียณอายุราชการ", ); } }