เพิ่มคำนวณวันเกษียณ
This commit is contained in:
parent
747d8c6b1c
commit
b0f7331f15
1 changed files with 25 additions and 0 deletions
25
src/interfaces/calculate-retire-date.ts
Normal file
25
src/interfaces/calculate-retire-date.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue