Merge file

This commit is contained in:
Methapon2001 2024-03-08 17:20:39 +07:00
parent 5fedb904c5
commit 610777e48d
2 changed files with 22 additions and 25 deletions

View file

@ -1,25 +0,0 @@
class CalculateDate {
birthDate: Date;
public static calculateRetireDate(birthDate: Date) {
let dd = birthDate.getDate();
let mm = birthDate.getMonth();
let yy = birthDate.getFullYear();
let g1 = true;
switch (mm) {
case 10:
if (dd >= 2) g1 = false;
break;
case 11:
case 12:
g1 = false;
break;
}
if (g1) return new Date(`${yy + 60}-09-30T00:00:00.000Z`);
else return new Date(`${yy + 61}-09-30T00:00:00.000Z`);
}
}
export default CalculateDate;

View file

@ -17,3 +17,25 @@ export function calculateAge(start: Date, end = new Date()) {
return { year, month, day };
}
export function calculateRetireDate(birthDate: Date) {
let dd = birthDate.getDate();
let mm = birthDate.getMonth();
let yy = birthDate.getFullYear();
let flag = true;
switch (mm) {
case 10:
if (dd >= 2) flag = false;
break;
case 11:
case 12:
flag = false;
break;
}
if (flag) return new Date(`${yy + 60}-09-30T00:00:00.000Z`);
return new Date(`${yy + 61}-09-30T00:00:00.000Z`);
}