When using MultiDatePicker("Dates Available", selection: $dates) and dates.count > 92, the dates aren't displayed correctly.
Any idea what might be the issue?
When using MultiDatePicker("Dates Available", selection: $dates) and dates.count > 92, the dates aren't displayed correctly.
Any idea what might be the issue?
Could you post the code so that one can test ?
I got the same error.
Up to 92 items are displayed well. For example, 92 days from October 1 to December 31. But when I select 93 days from October 1 to January 1, 2024, it doesn't display the selected date correctly.
I attach a video. If I select more than 93 days, it appears to display the selected date when scrolling, but you can see that it disappears immediately.
https://drive.google.com/file/d/1hf01EK3zo-UoG21MKmhIEM54-oH9Nr8A/view?usp=sharing
@Claude31 Here's a simple test:
import SwiftUI
struct MultiDatePickerTest: View {
@State var numberOfDates = 93
@State private var dates: Set<DateComponents> = []
var body: some View {
VStack {
Text("Number of dates: \(dates.count)")
MultiDatePicker("Dates Available", selection: $dates)
}
.onAppear() {
setRange()
}
}
func setRange() {
for i in 0..<numberOfDates {
dates.insert(Calendar.current.dateComponents([.calendar, .era, .year, .month, .day], from: Calendar.current.date(byAdding: .day, value: i, to: Date.now)!))
}
}
}
struct MultiDatePickerTest_Previews: PreviewProvider {
static var previews: some View {
MultiDatePickerTest(numberOfDates: 93)
}
}
To all. You should file bug reports.