I’m using the phonegap localNotifications plugin which specifies that I can set a notification to occur weekly.
However, it appears the javascript date object only has .getDay() and not .setDay().
I’ve got an json object of the days of the week I want to set to repeat,
set_days = {"mon":false, "tues":true,"wed":false,"thurs":true...}
how do you set a day in javascript? Because it is setting a notification, the day has to be in the future, so I don’t want to get the most recent “wednesday”, but only the next “wednesday”.
here’s a link to the plugin, but I don’t think this is really specific to the plugin.
You mean, in the current week? When does a week start?
Assuming it starts on Sunday (as in
getDay: 0 – Sunday, 1 – Monday, etc), this will work:To set the date to a weekday in the next 7 days, use this: