1const days = 738;
2const calculateTimimg = d => {
3 let months = 0, years = 0, days = 0, weeks = 0;
4 while(d){
5 if(d >= 365){
6 years++;
7 d -= 365;
8 }else if(d >= 30){
9 months++;
10 d -= 30;
11 }else if(d >= 7){
12 weeks++;
13 d -= 7;
14 }else{
15 days++;
16 d--;
17 }
18 };
19 return {
20 years, months, weeks, days
21 };
22};
23console.log(calculateTimimg(days));