I'm working on a reminders application using Phonegap [Javascript + Html5] in which the user enters the weekly task he wants to be reminded of and I'm supposed to alert a notification every week on that day.
Now the point is: I use Phonegap Local Notification Plugin to alert the notifications, this plugin takes a date to alert on time.
How can I give the needed date everyweek .. i.e: How Can I increment the counter when the day ends ?
Usually if the date if preknown: I use this function:
if (typeof plugins !== "undefined")
{
var RId = 0;
var rDate =new Date();
var RemDate = reminder_deadline.split("T")[0];
var RemTimeB = reminder_deadline.split("T")[1];
var RemTime = RemTimeB.split("Z")[0];
var RYear = RemDate.split("-")[0];
var RMonth = RemDate.split("-")[1];
var RMonth = RMonth-1;
var RDay = RemDate.split("-")[2];
var RHour = RemTime.split(":")[0];
var RMinute = RemTime.split(":")[1];
var RSecond = RemTime.split(":")[2];
alert(RYear+".."+RMonth+".."+RDay+".."+RHour+".."+RMinute+".."+RSecond);
rDate.setFullYear(RYear);
rDate.setMonth(RMonth);
rDate.setDate(RDay);
rDate.setHours(RHour);
rDate.setMinutes(RMinute);
rDate.setSeconds(RSecond);
plugins.localNotification
.add({
date: rDate,
message: reminder_name,
id: RId
});
}
RId++;
}
But now the user will just enter Monday ... & I'm supposed to notify him every Monday ... So is that possible to be made ?