1

I build a iOS 14 DatePicker. When I selected a date from the picker, it some date in format 27 Dec 2020 and some date show in format 26/12/2020. May I know what is the problem and how can I make it consistent?

enter image description hereenter image description here

struct ContentView : View {
    @State private var birthDate = Date()
    var body: some View {
        VStack(alignment: .leading){
            DatePicker(selection: $birthDate, in: Date()..., displayedComponents: .date){
                 Text("Date")
            }
        }.padding()
    }
}

Asperi
  • 228,894
  • 20
  • 464
  • 690
Oxford212
  • 89
  • 1
  • 8
  • Is this on same device, in one run-time? I cannot reproduce this, on my iOS 14.1 it shows `Dec 26, 2020`. If it is on different devices then it might depend on selected OS locale. – Asperi Dec 09 '20 at 07:52
  • @Asperi yes, in one run-time. I tested in both iOS 14.2 device and simulator. Both show the same problem. Edited with sample result. – Oxford212 Dec 09 '20 at 08:06
  • 2
    Probably it is one more (and seems not last) defect of 14.2 ... hmm... there are too many, actually, as for one minor update. – Asperi Dec 09 '20 at 08:09

0 Answers0