no message
This commit is contained in:
parent
928d806313
commit
2446c755e6
2 changed files with 38 additions and 30 deletions
|
|
@ -17,21 +17,31 @@ export function calculateAge(start: Date, end = new Date()) {
|
|||
// end.getDate();
|
||||
// }
|
||||
|
||||
if (day < 0) {
|
||||
month -= 1;
|
||||
day += new Date(end.getFullYear(), end.getMonth(), 0).getDate();
|
||||
}
|
||||
|
||||
if (month < 0) {
|
||||
month += 12;
|
||||
year -= 1;
|
||||
}
|
||||
if (day < 0) {
|
||||
month -= 1;
|
||||
day += new Date(end.getFullYear(), end.getMonth(), 0).getDate();
|
||||
}
|
||||
|
||||
if (month < 0) {
|
||||
month += 12;
|
||||
year -= 1;
|
||||
}
|
||||
|
||||
return { year, month, day };
|
||||
}
|
||||
|
||||
export function calculateRetireDate(birthDate: Date) {
|
||||
// let _birthDate = birthDate;
|
||||
|
||||
// _birthDate.setFullYear(_birthDate.getFullYear() + 60); var year = d.getFullYear();
|
||||
var d = birthDate;
|
||||
var year = d.getFullYear();
|
||||
var month = d.getMonth();
|
||||
var day = d.getDate();
|
||||
var c = new Date(year + 60, month, day);
|
||||
return c;
|
||||
}
|
||||
export function calculateRetireLaw(birthDate: Date) {
|
||||
let dd = birthDate.getDate();
|
||||
let mm = birthDate.getMonth();
|
||||
let yy = birthDate.getFullYear();
|
||||
|
|
@ -39,23 +49,21 @@ export function calculateRetireDate(birthDate: Date) {
|
|||
let flag = true;
|
||||
|
||||
switch (mm) {
|
||||
case 10:
|
||||
case 9:
|
||||
if (dd >= 2) flag = false;
|
||||
break;
|
||||
case 11:
|
||||
case 10:
|
||||
flag = false;
|
||||
break;
|
||||
case 12:
|
||||
case 11:
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (flag) return new Date(`${yy + 60}-09-30T00:00:00.000+07:00`);
|
||||
if (flag == true) return new Date(`${yy + 60}-09-30T00:00:00.000+07:00`);
|
||||
|
||||
return new Date(`${yy + 61}-09-30T00:00:00.000+07:00`);
|
||||
}
|
||||
export function calculateRetireLaw(birthDate: Date) {
|
||||
let yy = birthDate.getFullYear();
|
||||
return new Date(`${yy + 60}-09-30T00:00:00.000+07:00`);
|
||||
}
|
||||
|
||||
export function calculateRetireYear(birthDate: Date) {
|
||||
let dd = birthDate.getDate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue