I find myself perplexed by this particular issue.
Although the following code snippet appears to function correctly, it exhibits some peculiar behavior.
var tmpcurdte = eval(dataSource[i].startDate);
tmpcurdte.setDate(tmpcurdte.getDate() + 1);
while (tmpcurdte < tmpenddte) {
console.log("block date: " + tmpcurdte);
blockdayarray[blockdayarray.length] = tmpcurdte;
console.log("blockdayarray: " + blockdayarray);
tmpcurdte.setDate(tmpcurdte.getDate() + 1);
}
Output
block date :Sat Nov 12 2016 00:00:00 GMT+0100 (CET)
blockdayarray :**Sat Nov 12** 2016 00:00:00 GMT+0100 (CET)
block date :Sat Dec 31 2016 00:00:00 GMT+0100 (CET)
blockdayarray :**Sun Nov 13** 2016 00:00:00 GMT+0100 (CET),**Sat Dec 31** 2016 00:00:00 GMT+0100 (CET)
block date :Sun Jan 01 2017 00:00:00 GMT+0100 (CET)
blockdayarray :Sun Nov 13 2016 00:00:00 GMT+0100 (CET),**Sun Jan 01 2017** 00:00:00 GMT+0100 (CET),**Sun Jan 01 2017** 00:00:00 GMT+0100 (CET)
block date :Sat Feb 04 2017 00:00:00 GMT+0100 (CET)
blockdayarray :Sun Nov 13 2016 00:00:00 GMT+0100 (CET),Mon Jan 02 2017 00:00:00 GMT+0100 (CET),**Mon Jan 02 2017** 00:00:00 GMT+0100 (CET),Sat Feb 04 2017 00:00:00 GMT+0100 (CET)
It's interesting to note that the date in the array changes when a new one is added. I'm in need of assistance or an explanation on this matter. Can anyone provide insight?