In Expo docs there is this example to show a notification after 60 seconds.
import * as Notifications from 'expo-notifications';
Notifications.scheduleNotificationAsync({
content: {
title: "Time's up!",
body: 'Change sides!',
},
trigger: {
seconds: 60,
},
});
But how can I show a notification in a specific date for example at 08/28/2022 08:30AM
Just a quick example of how to use the date property as Dmitro_ specified in the comment. It's actually DateTriggerInput notification type and you can use it as follows:
let date = new Date();
//Add 10 seconds to the current date to test it.
date.setSeconds(date.getSeconds() + 10);
await Notifications.scheduleNotificationAsync({
content: {...},
trigger: { date: date},
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With