simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -44,11 +44,7 @@ class SpecialRegionsBuilder {
|
||||
for (var day = rangeStart; !day.isAfter(rangeEnd); day = day.addDays(1)) {
|
||||
if (holidayDays.contains(_dayKey(day))) continue;
|
||||
for (final p in breakPeriods) {
|
||||
final start = day.copyWith(
|
||||
hour: p.start.hour,
|
||||
minute: p.start.minute,
|
||||
);
|
||||
breakRegions.add(_breakRegion(start, p.duration));
|
||||
breakRegions.add(_breakRegion(day.withTime(p.start), p.duration));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,16 +60,8 @@ class SpecialRegionsBuilder {
|
||||
// on top of each other.
|
||||
final byDay = <String, _HolidayDay>{};
|
||||
for (final holiday in holidays.result) {
|
||||
final startDay = DateTime(
|
||||
holiday.startDate.year,
|
||||
holiday.startDate.month,
|
||||
holiday.startDate.day,
|
||||
);
|
||||
final endDay = DateTime(
|
||||
holiday.endDate.year,
|
||||
holiday.endDate.month,
|
||||
holiday.endDate.day,
|
||||
);
|
||||
final startDay = holiday.startDate.dateOnly;
|
||||
final endDay = holiday.endDate.dateOnly;
|
||||
// Webuntis treats endDate inclusively (last day of the break) — the
|
||||
// `+ 1` covers single-day public holidays (where startDate == endDate)
|
||||
// and the final day of a multi-day vacation, both of which would
|
||||
|
||||
Reference in New Issue
Block a user