From 8a4bc55c6d051b2abbf381935310a48bd7ba7bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= <elias@elias-mueller.com> Date: Mon, 6 Mar 2023 12:47:01 +0100 Subject: [PATCH] Fix displaying previous week on weekends to display next week --- lib/data/timetable/timetableProps.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/data/timetable/timetableProps.dart b/lib/data/timetable/timetableProps.dart index cf08e20..70a534e 100644 --- a/lib/data/timetable/timetableProps.dart +++ b/lib/data/timetable/timetableProps.dart @@ -1,4 +1,6 @@ +import 'dart:developer'; + import 'package:intl/intl.dart'; import 'package:marianum_mobile/api/apiResponse.dart'; import 'package:marianum_mobile/api/webuntis/queries/getHolidays/getHolidaysCache.dart'; @@ -86,6 +88,8 @@ class TimetableProps extends DataHolder { void nearest() { _queryWeek = _queryWeek = DateTime.now(); + if(_queryWeek.weekday == DateTime.saturday || _queryWeek.weekday == DateTime.sunday) _queryWeek = _queryWeek.add(const Duration(days: 2)); + log("Nearest week Query: ${_queryWeek.toIso8601String()}"); updateWeek(); }