Cloud Stack Ninja

I have an application coded with ionic 3 which must record the date of an event, then remind the user (via local notifications) 2 days before the event and the day before the event. when i run the code below i don't get any error, but i also don't see my notification when i try to list all registered notifications with this.localNotifications.getAll ();

I get the date using this: <ion-datetime displayFormat="DD MMM YYYY à HH:mm" pickerFormat="D MMMM YYYY HH:mm" [(ngModel)]="myDate" name="tokoss"></ion-datetime>

then I create the notification as well

myDate : Date ;
setNotification(){
    var date = new Date(this.myDate);
    date.setDate(date.getDay()-2); //back for 2 days
    console.log(date);
    this.localNotifications.schedule({
      id: 1,
      text: 'Single Local Notification 2 days',
      trigger: { at: new Date(date) },
      data: { secret: 'secret' }
    });
  }

how to fix this problem please



Read more here: https://stackoverflow.com/questions/64398281/schedule-a-local-notification-2-days-before-a-date-selected-by-the-user

Content Attribution

This content was originally published by Mr kaplan237 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: