const schedulePrayerTime = async (vakit, time) => {
const [hours, minutes] = time.split(':');
// Bugünün tarihini al
const now = new Date();
// Hedef zamanı oluştur
const scheduledTime = new Date();
scheduledTime.setHours(parseInt(hours));
scheduledTime.setMinutes(parseInt(minutes));
scheduledTime.setSeconds(0);
// Eğer hedef zaman bugün için geçmişse, yarına planla
if (scheduledTime <= now) {
scheduledTime.setDate(scheduledTime.getDate() + 1);
}
return await Notifications.scheduleNotificationAsync({
content: {
title: "Namaz Vakti",
body: `${vakit.toUpperCase()} vakti girdi`,
sound: true,
},
trigger: {
date: scheduledTime,
repeats: true,
},
});
};