SwifUI 2 : DatePicker display different format of selected Date

93 views Asked by At

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()
    }
}

0

There are 0 answers