zo0r / react-native-push-notification

React Native Local and Remote Notifications
MIT License
6.76k stars 2.05k forks source link

localNotificationSchedule but everyweek same day and hour #1697

Closed mtalhagaoglu closed 3 years ago

mtalhagaoglu commented 3 years ago

Hi. I want to send local notification scheduled. For example every week on mondays at 09:00 it will send "good morning!" message. I read the documentation but i didn't quite understand. There is repeatType prop and date prop. as i understand repeatType should be week because it will be triggered every week on mondays but i didn't understand date prop. is it enough to be any monday at 09:00 date object?

PushNotification.localNotificationSchedule({
  //... You can use all the options from localNotifications
  message: "good morning", // (required)
  date: new Date(), //any monday at 09:00
  allowWhileIdle: true, // (optional) set notification to work while on doze, default: false,
repeatType: "week"
});
Dallas62 commented 3 years ago

Hi, the date must be the next date you want to see a notification. Not in the past and not too late in the future.

mtalhagaoglu commented 3 years ago

so counter will start from that day and send notification every week after that. thanks

kristoff2016 commented 3 years ago

this is correct for every day in the morning at 8 AM?

PushNotification.localNotificationSchedule({ message: "Good moring", date: moment({ hour: 8, minute: 0 }), allowWhileIdle: true, repeatType: 'day' })