hi guys im trying to create a time picker which hours are only from (2pm - 9pm) and minutes are incremented by 30 this is the picture of timePicker that i want to create here is my code
func creatTimePicker() {
timePicker.datePickerMode = .time
timePicker.minuteInterval = 30
let timeformatter = DateFormatter()
timeformatter.dateFormat = "HH:mm"
let min = timeformatter.date(from: "5:00")
let max = timeformatter.date(from: "9:00")
timePicker.minimumDate = min
timePicker.maximumDate = max
self.contentView.addSubview(timePicker)
}
the problem is hour starts 1-12 and minute starts 00-59 what is the problem? thank you