Merge file
This commit is contained in:
parent
5fedb904c5
commit
610777e48d
2 changed files with 22 additions and 25 deletions
|
|
@ -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;
|
|
||||||
|
|
@ -17,3 +17,25 @@ export function calculateAge(start: Date, end = new Date()) {
|
||||||
|
|
||||||
return { year, month, day };
|
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`);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue