diff --git a/Workouts/Views/Today/TodayView.swift b/Workouts/Views/Today/TodayView.swift index 12afa1f..e8d0fde 100644 --- a/Workouts/Views/Today/TodayView.swift +++ b/Workouts/Views/Today/TodayView.swift @@ -288,9 +288,20 @@ struct TodayView: View { } /// Day-precision (year/month/day) components of every day with at least one - /// logged workout — the day picker decorates these with a dot. + /// logged workout — the day picker decorates these with a dot. Built as *bare* + /// y/m/d components, not `dateComponents([.year, .month, .day], from:)` output: + /// the latter also sets `isLeapMonth = false`, which `==` ignores but hashing + /// doesn't — so a bare-components `Set.contains` probe (the day picker's) would + /// miss every member. private var workoutDays: Set { - Set(workouts.map { Calendar.current.dateComponents([.year, .month, .day], from: $0.start) }) + Set(workouts.map { workout in + let c = Calendar.current.dateComponents([.year, .month, .day], from: workout.start) + var day = DateComponents() + day.year = c.year + day.month = c.month + day.day = c.day + return day + }) } /// Row icon color: the routine's own color, or the goal's color as a generic