3

I want to display multiple dates using MultiDatePicker. At this time, if the selected date exceeds 92, it is not displayed properly.

The testable code is very simple.

import SwiftUI

struct MultiDatePickerTest: View {
    @State var selectedDates: Set<DateComponents> = []
    
    var body: some View {
        MultiDatePicker("sample", selection: $selectedDates)
    }
}

struct MultiDatePickerTest_Previews: PreviewProvider {
    static var previews: some View {
        MultiDatePickerTest()
    }
}

You can find out by changing the number of selectedDate when creating a MultiDatePicker as above.

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. (Changing the year is not the cause.)

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.

Any idea what might be the issue?

https://drive.google.com/file/d/1hf01EK3zo-UoG21MKmhIEM54-oH9Nr8A/view?usp=sharing

2
  • actually its not only when you select 92 days, for me the issue also happens when you even select total 4-5 days just in different months (1 random day per month) Commented Dec 29, 2024 at 16:31
  • even if you just pick two days with 4 month difference it acts weird, I can't believe Apple allowed that, what we are supposed to do for < iOS 18 users.. Commented Dec 29, 2024 at 18:31

1 Answer 1

1

That's a bug which Apple fixed in iOS 18 Beta (build 22A5282m, June 10, 2024).

Sign up to request clarification or add additional context in comments.

1 Comment

even if you just pick two days with 4 month difference it acts weird, I can't believe Apple allowed that, what we are supposed to do for < iOS 18 users..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.