trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

minTime and maxTime minute values work incorrectly with sliders #819

Open DavidAnderson684 opened 9 years ago

DavidAnderson684 commented 9 years ago

When passing minTime and maxTime together with controlType: 'slider', the minute values from the minTime and maxTime are treated as minima/maxima across all hours of the day, instead of only apply on the book-end hours.

e.g. minTime: 7:25 am maxTime: 8:45 pm controlType: 'slider'

This results in only being able to select the minute range 25-45 throughout all hours from 7am to 8pm. i.e. You can choose 7:25-7:45am, 8:25-8:45am, ... 8:25-8:45pm. You cannot select other times.

DavidAnderson684 commented 9 years ago

Just to be clear: this does work when using controlType: 'dropdown'. The drop-down then shows the full range of possible minutes on intervening hours.

DavidAnderson684 commented 7 years ago

In fact, this can happen with the dropdown too, if you pass a maxTime whose minute value is greater than the minute value of the minTime. The problem seems to be that minuteMax is calculated from maxDateTime.getMinutes(), and then minuteMax is used with no reference to what the hour was.

For example, pass in options stepMinute: 15, maxTime: "10:15pm", minTime: "11:45am".

DavidAnderson684 commented 7 years ago

..., and similarly, if the minute value in maxTime is greater than the minute value in minTime, and if the initial hour upon the opening of the picker is set to the minTime, and if a dropdown is used, then the picker will correctly not show earlier minutes for that hour..... but if you change the hour to a later one, it will erroneously not then show the other minute options.

Nukro commented 4 years ago

@DavidAnderson684 Had you found any fix for this issue? I have the issue with the dropdown option where minTime is set to 11:30 and maxTime to 12:45.

DavidAnderson684 commented 4 years ago

This is a few years ago, but IIRC, I just stopped using minTime/maxTime and made do with minDate/maxDate.