Stabilize beta release with warning cleanup and edge-case fixes
This commit is contained in:
@@ -362,18 +362,15 @@ struct DateRangePickerSheet: View {
|
||||
|
||||
Section {
|
||||
Button("Next 7 Days") {
|
||||
startDate = Date()
|
||||
endDate = Calendar.current.date(byAdding: .day, value: 7, to: Date()) ?? Date()
|
||||
applyQuickRange(days: 7)
|
||||
}
|
||||
|
||||
Button("Next 14 Days") {
|
||||
startDate = Date()
|
||||
endDate = Calendar.current.date(byAdding: .day, value: 14, to: Date()) ?? Date()
|
||||
applyQuickRange(days: 14)
|
||||
}
|
||||
|
||||
Button("Next 30 Days") {
|
||||
startDate = Date()
|
||||
endDate = Calendar.current.date(byAdding: .day, value: 30, to: Date()) ?? Date()
|
||||
applyQuickRange(days: 30)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,6 +391,15 @@ struct DateRangePickerSheet: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func applyQuickRange(days: Int) {
|
||||
let calendar = Calendar.current
|
||||
let start = calendar.startOfDay(for: Date())
|
||||
let endDay = calendar.date(byAdding: .day, value: days, to: start) ?? start
|
||||
let end = calendar.date(bySettingHour: 23, minute: 59, second: 59, of: endDay) ?? endDay
|
||||
startDate = start
|
||||
endDate = end
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Schedule Diagnostics Sheet
|
||||
|
||||
Reference in New Issue
Block a user