I have two date variables. The first one defaults to last friday. Based on this date I'm trying to add a month to it. When I try the following code, it does not seem to work.
var StartDate = new Date()
var DayOfWeek = 5;//friday
StartDate.setDate(StartDate.getDate() + (dayOfWeek - 7 - StartDate.getDay()) % 7);
This does not seem to work.
var EndDate = new Date(StartDate)
EndDate.setDate(EndDate.getMonth() + 7)
Aucun commentaire:
Enregistrer un commentaire