add min/max ranges for times
This commit is contained in:
parent
bd5442de72
commit
6f33592880
1 changed files with 12 additions and 6 deletions
18
jquery-ui-timepicker-addon.js
vendored
18
jquery-ui-timepicker-addon.js
vendored
|
@ -37,6 +37,12 @@
|
||||||
hour: 0,
|
hour: 0,
|
||||||
minute: 0,
|
minute: 0,
|
||||||
second: 0,
|
second: 0,
|
||||||
|
hourMin: 0,
|
||||||
|
minuteMin: 0,
|
||||||
|
secondMin: 0,
|
||||||
|
hourMax: 23,
|
||||||
|
minuteMax: 59,
|
||||||
|
secondMax: 59,
|
||||||
alwaysSetTime: true
|
alwaysSetTime: true
|
||||||
};
|
};
|
||||||
$.extend(this.defaults, this.regional['']);
|
$.extend(this.defaults, this.regional['']);
|
||||||
|
@ -149,9 +155,9 @@
|
||||||
// Added by Peter Medeiros:
|
// Added by Peter Medeiros:
|
||||||
// - Figure out what the hour/minute/second max should be based on the step values.
|
// - Figure out what the hour/minute/second max should be based on the step values.
|
||||||
// - Example: if stepMinute is 15, then minMax is 45.
|
// - Example: if stepMinute is 15, then minMax is 45.
|
||||||
var hourMax = 23 - (23 % opts.stepHour);
|
var hourMax = opts.hourMax - (opts.hourMax % opts.stepHour);
|
||||||
var minMax = 59 - (59 % opts.stepMinute);
|
var minMax = opts.minuteMax - (opts.minuteMax % opts.stepMinute);
|
||||||
var secMax = 59 - (59 % opts.stepSecond);
|
var secMax = opts.secondMax - (opts.secondMax % opts.stepSecond);
|
||||||
|
|
||||||
// Prevent displaying twice
|
// Prevent displaying twice
|
||||||
if ($dp.find("div#ui-timepicker-div").length === 0) {
|
if ($dp.find("div#ui-timepicker-div").length === 0) {
|
||||||
|
@ -181,7 +187,7 @@
|
||||||
tp_inst.hour_slider = $tp.find('#ui_tpicker_hour').slider({
|
tp_inst.hour_slider = $tp.find('#ui_tpicker_hour').slider({
|
||||||
orientation: "horizontal",
|
orientation: "horizontal",
|
||||||
value: tp_inst.hour,
|
value: tp_inst.hour,
|
||||||
min: 0,
|
min: opts.hourMin,
|
||||||
max: hourMax,
|
max: hourMax,
|
||||||
step: opts.stepHour,
|
step: opts.stepHour,
|
||||||
slide: function(event, ui) {
|
slide: function(event, ui) {
|
||||||
|
@ -195,7 +201,7 @@
|
||||||
tp_inst.minute_slider = $tp.find('#ui_tpicker_minute').slider({
|
tp_inst.minute_slider = $tp.find('#ui_tpicker_minute').slider({
|
||||||
orientation: "horizontal",
|
orientation: "horizontal",
|
||||||
value: tp_inst.minute,
|
value: tp_inst.minute,
|
||||||
min: 0,
|
min: opts.minuteMin,
|
||||||
max: minMax,
|
max: minMax,
|
||||||
step: opts.stepMinute,
|
step: opts.stepMinute,
|
||||||
slide: function(event, ui) {
|
slide: function(event, ui) {
|
||||||
|
@ -208,7 +214,7 @@
|
||||||
tp_inst.second_slider = $tp.find('#ui_tpicker_second').slider({
|
tp_inst.second_slider = $tp.find('#ui_tpicker_second').slider({
|
||||||
orientation: "horizontal",
|
orientation: "horizontal",
|
||||||
value: tp_inst.second,
|
value: tp_inst.second,
|
||||||
min: 0,
|
min: opts.secondMin,
|
||||||
max: secMax,
|
max: secMax,
|
||||||
step: opts.stepSecond,
|
step: opts.stepSecond,
|
||||||
slide: function(event, ui) {
|
slide: function(event, ui) {
|
||||||
|
|
Loading…
Reference in a new issue