How to get the dates in a array from today to next 15 days and need to exclude saturday's and sunday's. Ex: today is 4/5/22 and I need 15 days in a array,
like['4/5/22', '5/5/22', '6/5/22'.....'19/5/22'].
I found few links, but here I'm getting future date. Could you please help me how to get the all dates in a array.
var dt = new Date();
dt.setDate(dt.getDate() + 3);
var loop_ = 15;
var start = Date.now();
var response = [start];
while(loop_> 0){ var nextD = response[response.length-1]+86400000; const nextD_ = new Date(nextD); if(nextD_.getDay() !== 7 && nextD_.getDay() !== 1){response.push(nextD); loop_ = loop_-1} }
console.log(response)
Sunday is equal to 1, and saturday to 7 (English calendar)