How to set lunar calendar UIDatePicker in iOS

1k views Asked by At

I need switch UIDatePicker between Solar calendar and Lunar calendar. With Lunar calendar, I can get 02/30/2016 (MM/dd/yyyy), but with Solar calendar, its never get 02/30/2016 (MM/dd/yyyy). So, how can set it in UIDatePicker ?

2

There are 2 answers

1
NSDmitry On

I don't think it is possible, all supported calendars can be found in Apple Documentation

0
John Pang On

Lunar Calendar is also known is Chinese Calendar. Try these

self.datePicker.locale = Locale.init(identifier: "zh")
self.datePicker.calendar = Calendar.init(identifier: .chinese)

However, I tried both in simulator and with some app, there is no 2016/02/30 in Lunar. There is 2016/2/29 which convert to 2016/4/6 in Solar. There is 2015/02/30 Lunar (see below)

Lunar Date Picker

However, in the date picker, it shows all the leap months even it is invalid.