This is the code I use to generate the date picker:
DatePicker("", selection: $selectedDate, displayedComponents: [.date, .hourAndMinute])
.datePickerStyle(CompactDatePickerStyle())
.labelsHidden()
.clipped()
CodePudding user response:
As far as I know this was a bug associated with the datepicker
. Seems that it is still not fixed. There was a workaround for that as follows.
DatePicker("", selection: $selectedDate, displayedComponents: [.date, .hourAndMinute])
.datePickerStyle(CompactDatePickerStyle())
.labelsHidden()
.clipped()
.id(selectedDate)