File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -304,9 +304,16 @@ class Utils {
304
304
final nextAlarm = todayAlarm.add (const Duration (days: 1 ));
305
305
duration = nextAlarm.difference (now);
306
306
}
307
- } else if (now.isBefore (todayAlarm) && days[now.weekday - 1 ]) {
308
- // If alarm is set for today and time hasn't passed
309
- duration = todayAlarm.difference (now);
307
+ } else if (days[now.weekday - 1 ]) {
308
+ // If alarm is set for today
309
+ if (now.isBefore (todayAlarm)) {
310
+ // Time hasn't passed yet for the repeating alarm
311
+ duration = todayAlarm.difference (now);
312
+ } else {
313
+ // Schedule the alarm for the next occurrence of the same day
314
+ final nextAlarm = todayAlarm.add (const Duration (days: 7 ));
315
+ duration = nextAlarm.difference (now);
316
+ }
310
317
} else {
311
318
// Finding the next day when alarm will ring
312
319
int daysUntilNextAlarm = 7 ;
You can’t perform that action at this time.
0 commit comments