fixed dates before now

main
Kai Mannweiler 2023-02-25 14:39:05 +01:00
parent d917387bb4
commit 36abb7da36
1 changed files with 2 additions and 1 deletions

View File

@ -48,7 +48,8 @@ List<TZDateTime> createTZDateTimes(
selectedDays.map((day) => weekDays[day]); selectedDays.map((day) => weekDays[day]);
for (int i = 0; i < trainingTime; i++) { for (int i = 0; i < trainingTime; i++) {
final DateTime date = DateTime.now().add(Duration(days: i)); final DateTime date = DateTime.now().add(Duration(days: i));
if (selectedDaysInt.contains(date.weekday)) { if (selectedDaysInt.contains(date.weekday) &&
date.isAfter(DateTime.now())) {
tzDateTimes.add(TZDateTime.local(date.year, date.month, date.day, tzDateTimes.add(TZDateTime.local(date.year, date.month, date.day,
selectedHours, selectedMinutes, 0, 0, 0)); selectedHours, selectedMinutes, 0, 0, 0));
} }