refactor(utils): merge 2 statement of same conditions
This commit is contained in:
parent
ae49719734
commit
0e1d5f0bf8
1 changed files with 4 additions and 2 deletions
|
|
@ -5,8 +5,10 @@ export function calculateAge(start: Date, end = new Date()) {
|
|||
let month = end.getMonth() - start.getMonth();
|
||||
let day = end.getDate() - start.getDate();
|
||||
|
||||
if (month < 0) year -= 1;
|
||||
if (month < 0) month += 12;
|
||||
if (month < 0) {
|
||||
month += 12;
|
||||
year -= 1;
|
||||
}
|
||||
if (day < 0) {
|
||||
month -= 1;
|
||||
day =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue