0

I was looking into getting all mondays in a month, in order to create a full list of weeks between two predefined dates and I found this solution on stackoverflow. It works like charm on chrome but not on firefox: takes too long and breaks. Debugging the code it turns out this bit of code takes a lot of time to execute:

// Get the first Monday in the month
while (d.getDay() != 1) {
    d.setDate(d.getDate() + 1);
}

I usually run my apps on chrome but I want the users to be able to run it on firefox if they prefer. So is there a way to do this without it breaking?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Chayma Atallah
  • 725
  • 2
  • 13
  • 30

0 Answers0