3

I would like display a date picker contained only month and year.

The default DatePicker display day, month and year. It's not possible to remove day and set a min and max date.

How generate this month picker in SwiftUI?

enter image description here

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
Dev Loots
  • 708
  • 9
  • 28
  • i think you have to do it "manually" ... – Chris Nov 26 '19 at 17:26
  • Ok, have you an example for a custom DatePicker in SwiftUI ? – Dev Loots Nov 26 '19 at 18:42
  • Do o you just want month names or month and year? – LuLuGaGa Nov 26 '19 at 20:40
  • I would liké Month and year (if possible month and year separated) – Dev Loots Nov 26 '19 at 21:34
  • 1
    Example here https://github.com/Jinxiansen/SwiftUI/blob/master/README.md#Picker. Just add a second picker. – Chris Nov 27 '19 at 08:51
  • Internally they use `UIDatePicker` (don't ask... couple of crashes) and all modes it has are : .time, .date, .dateAndTime, and .countDownTimer. So... – Asperi Nov 27 '19 at 17:38
  • Does this answer your question? [How do I change the appearance of the DatePicker in the SwiftUI framework to only months and years?](https://stackoverflow.com/questions/62271628/how-do-i-change-the-appearance-of-the-datepicker-in-the-swiftui-framework-to-onl) – Jonas Deichelmann Aug 12 '20 at 06:37

0 Answers0