How to use rangeDataMode correctly in NSDatePicker?

237 Views Asked by At

In a Mac OS X app, I try to set the datePickerMode to use rangeDataMode because I do want to pick up a range of dates (a start date & an end date).

let datePicker = NSDatePicker()
datePicker.datePickerMode = .rangeDateMode

However, the NSDatePicker still works like singleDateMode. I can only specify one date in that NSDatePicker.

How to use rangeDataMode correctly?

1

There are 1 best solutions below

0
Charles Srstka On

As far as I can tell, .rangeDateMode only seems to have an effect when datePickerStyle is set to .clockAndCalendarDatePickerStyle, since as you have noticed, the default "stepper" style doesn't have any obvious UI for selecting a range rather than an individual date. Try running the date picker in calendar style, and you should be able to select ranges.