jQuery-Timepicker-Addon icon indicating copy to clipboard operation
jQuery-Timepicker-Addon copied to clipboard

minTime and maxTime minute values work incorrectly with sliders

Open DavidAnderson684 opened this issue 9 years ago • 5 comments

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 avatar May 26 '15 10:05 DavidAnderson684

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 avatar May 26 '15 10:05 DavidAnderson684

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 avatar Feb 09 '17 16:02 DavidAnderson684

..., 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.

DavidAnderson684 avatar Feb 10 '17 08:02 DavidAnderson684

@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.

Nukro avatar Aug 17 '20 09:08 Nukro

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

DavidAnderson684 avatar Aug 17 '20 09:08 DavidAnderson684