I have a pair of Unix timestamps:
let start: number = 1632988953;
const end: number = 1638259353;
My goal is to iterate over these two dates, recalculating the new start
date in each iteration.
To achieve this, I am utilizing a while
loop as shown below:
const datesArray = [];
while (start <= end) {
let newDate = dayjs.unix(start).add(5, 'day').unix();
datesArray.push(newDate);
start = newDate;
}
However, upon executing this while
loop within the function, it results in infinite iterations which ultimately leads to high resource consumption and crashes the browser. Can anyone help me identify what might be causing this issue?