I've incorporated the the time picker into my app and it's working fine. However, one minute resolution is much more than I need for this project. Things would be a lot cleaner if I could only present the user with options for 0, 15, 30, and 45 minutes after every hour. Is there a way I can set the time picker to only give options for 15 minute intervals?
Thanks,
Mike
0 ·
Comments
I achieved this result by looking at the code for the TimePicker (https://github.com/enyojs/onyx/blob/master/source/TimePicker.js) and creating a new kind called
IntervalTimePicker
which inherits from TimePicker. Then, I overrode theinitDefaults()
method, which, as you can see in the source, is used by TimePicker to render the components, to call myminuteIntervalChanged
method which destroys the existingminutePicker
client controls and then rebuilds them based on our interval value.http://jsfiddle.net/arthurthornton/g8aqr/