I want to set week day index (not month day) in time
for example:
"2021-11-01T10:50:02+04:00" should be converted to "2021-11-08T10:50:02+04:00"
"2021-11-02T10:50:02+04:00" should be converted to "2021-11-08T10:50:02+04:00"
and so on
basically my task is to convert any week day to friday
>Solution :
So update myDate to Friday (in current week), you could do something like this:
var dayToSet = 5; // Friday
var currentDay = myDate.getDay();
var distance = dayToSet - currentDay;
myDate.setDate(myDate.getDate() + distance);