Local notification in ionic 2


#1

I am trying to implement local notification to ionic 2. I am following this https://ionicframework.com/docs/native/local-notifications/.
And I am able to set local notification , but I can set by hard coding time value in seconds. Eg.
Notification 5 seconds after I set

this.localNotifications.schedule({
text: ‘You will get this notification after 5 seconds’,
at: new Date(new Date().getTime() + 5*1000),
led: ‘FF0000’,
sound: null
});

But I need user to choose date and time and set notification respectively. I am taking date and time from user in prompt, like below,

let prompt = this.alertCtrl.create({
title: ‘FOLLOW UP’,
message: “Details for Reminder :”,
inputs: [
{
name: ‘notificatioDate’,
placeholder: ‘notificatioDate’,
type:‘date’
},
{
name: ‘notificatioTtime’,
placeholder: ‘notificationTime’,
type:‘time’
},
{
name: ‘remarks’,
placeholder: ‘Remarks’,
// type:‘Number’
},
],
buttons: [
{
text: ‘Cancel’,
handler: data => {
console.log(‘Cancel clicked’);
}
},
{
text: ‘Save’,
handler: data => {
console.log(‘Saved clicked’+data.remarks);
console.log(‘notificatioDate=’+data.notificatioDate);
console.log(‘notificatioTtime=’+data.notificatioTtime);
this.LocalNotification1.setReminder1(data.remarks,data.notificatioDate);

      }
    }
  ]
});
prompt.present();

Pl. help


#2

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.