I created a todo app using the expo-notifications library and datatimepickermodal.
This is the code I set for the current day:
const scheduleTodoNotification = async (todo) => {
// set trigger date and time todo.date if todo is today e.g 4/5/2023 1230AM
const trigger = new Date (todo.date)
try {
await Notifications.scheduleNotificationAsync({
content: {
title: "Alert! Tu hai un'attività da fare!",
body: todo.text,
},
trigger,
});
console.log('Notificazione pianificata')
} catch (error) {
alert('The notification failed to schedule')
}
};
I'm not able to set the code to notify the user of the activities he has to do for each date and time the choosen. How can I notify the user of the activity he has to perform on a day other than the current day?