Stabilize beta release with warning cleanup and edge-case fixes

This commit is contained in:
Trey t
2026-02-22 13:18:14 -06:00
parent fddea81e36
commit ec2bbb4764
55 changed files with 712 additions and 315 deletions

View File

@@ -27,8 +27,13 @@ final class TripWizardViewModel {
// MARK: - Dates
var startDate: Date = Date()
var endDate: Date = Date().addingTimeInterval(86400 * 7)
var startDate: Date = Calendar.current.startOfDay(for: Date())
var endDate: Date = {
let calendar = Calendar.current
let start = calendar.startOfDay(for: Date())
let endDay = calendar.date(byAdding: .day, value: 7, to: start) ?? start
return calendar.date(bySettingHour: 23, minute: 59, second: 59, of: endDay) ?? endDay
}()
var hasSetDates: Bool = false
// MARK: - Regions
@@ -212,13 +217,17 @@ final class TripWizardViewModel {
defer { isLoadingSportAvailability = false }
var availability: [Sport: Bool] = [:]
let calendar = Calendar.current
let queryStart = calendar.startOfDay(for: startDate)
let endDay = calendar.startOfDay(for: endDate)
let queryEnd = calendar.date(bySettingHour: 23, minute: 59, second: 59, of: endDay) ?? endDay
for sport in Sport.supported {
do {
let games = try await AppDataProvider.shared.filterGames(
sports: [sport],
startDate: startDate,
endDate: endDate
startDate: queryStart,
endDate: queryEnd
)
availability[sport] = !games.isEmpty
} catch {