Skip to content

Step minute issue #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TimeToogo opened this issue May 12, 2011 · 3 comments
Closed

Step minute issue #149

TimeToogo opened this issue May 12, 2011 · 3 comments

Comments

@TimeToogo
Copy link

If i set the step for the minute slider to 5, maximum value on the slider is 59 while it should be 55. if someone could provide a fix for this issue it would be greatly appreciated.

@althaus
Copy link
Contributor

althaus commented May 18, 2011

Yeah... recognized this, too. I'll see if I can spare some time and look into it.

@alexandergitter
Copy link
Contributor

This is caused by _limitMinMaxDateTime. To fix the sliders you can replace

if(adjustSliders !== undefined && adjustSliders === true){
  this.hour_slider.slider("option", { min: this._defaults.hourMin, max: this._defaults.hourMax }).slider('value', this.hour);
  this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: this._defaults.minuteMax }).slider('value', this.minute);
  this.second_slider.slider("option", { min: this._defaults.secondMin, max: this._defaults.secondMax }).slider('value', this.second);
}

with the following code inspired by _injectTimePicker

if(adjustSliders !== undefined && adjustSliders === true){
  var hourMax = (this._defaults.hourMax - (this._defaults.hourMax % this._defaults.stepHour)).toFixed(0),
    minMax  = (this._defaults.minuteMax - (this._defaults.minuteMax % this._defaults.stepMinute)).toFixed(0),
    secMax  = (this._defaults.secondMax - (this._defaults.secondMax % this._defaults.stepSecond)).toFixed(0);

  this.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
  this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: minMax }).slider('value', this.minute);
  this.second_slider.slider("option", { min: this._defaults.secondMin, max: secMax }).slider('value', this.second);
}

The code before that probably needs some adjustment as well.

trentrichardson added a commit that referenced this issue Jun 8, 2011
Fix issue #149, sliders max values should not allow for partial steps
@RAD-X
Copy link

RAD-X commented May 23, 2014

This fix is not a solution.
Problem appears if you want create for e.g. time ranges.
For example if you want to set a time range from 8:00 to end of this day, it has to be 23:59. But if you have option stepMinute=5, you can't set 23:59.
So main difference is how you use a Step options in Timepicker - for some kind of imput validation or for easy time adjustment.
Therefore, this should be fixed or there should be a new option for this behavior. For example stepMinuteToMax, that enable possibility to set 59 on the slider right after last step if hour value is 23.
Same for stepSeconds... for ability to set 23:59:59, etc...

Excuse my bad English. :-P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants