mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Fix issue #333
This commit is contained in:
parent
f644defe1d
commit
f8a2c0810e
@ -1682,8 +1682,10 @@
|
|||||||
time = '';
|
time = '';
|
||||||
h = '';
|
h = '';
|
||||||
m = '';
|
m = '';
|
||||||
|
|
||||||
line_time = function line_time(h, m) {
|
line_time = function line_time(h, m) {
|
||||||
var now = _xdsoft_datetime.now(), optionDateTime, current_time;
|
var now = _xdsoft_datetime.now(), optionDateTime, current_time,
|
||||||
|
isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
|
||||||
now.setHours(h);
|
now.setHours(h);
|
||||||
h = parseInt(now.getHours(), 10);
|
h = parseInt(now.getHours(), 10);
|
||||||
now.setMinutes(m);
|
now.setMinutes(m);
|
||||||
@ -1701,9 +1703,12 @@
|
|||||||
|
|
||||||
current_time = new Date(_xdsoft_datetime.currentTime);
|
current_time = new Date(_xdsoft_datetime.currentTime);
|
||||||
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
|
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
|
||||||
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
|
|
||||||
|
if (!isALlowTimesInit) {
|
||||||
|
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
|
||||||
|
}
|
||||||
|
|
||||||
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) {
|
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
|
||||||
if (options.defaultSelect || datetimepicker.data('changed')) {
|
if (options.defaultSelect || datetimepicker.data('changed')) {
|
||||||
classes.push('xdsoft_current');
|
classes.push('xdsoft_current');
|
||||||
} else if (options.initTime) {
|
} else if (options.initTime) {
|
||||||
|
2
build/jquery.datetimepicker.full.min.js
vendored
2
build/jquery.datetimepicker.full.min.js
vendored
File diff suppressed because one or more lines are too long
4
build/jquery.datetimepicker.min.js
vendored
4
build/jquery.datetimepicker.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1682,8 +1682,10 @@
|
|||||||
time = '';
|
time = '';
|
||||||
h = '';
|
h = '';
|
||||||
m = '';
|
m = '';
|
||||||
|
|
||||||
line_time = function line_time(h, m) {
|
line_time = function line_time(h, m) {
|
||||||
var now = _xdsoft_datetime.now(), optionDateTime, current_time;
|
var now = _xdsoft_datetime.now(), optionDateTime, current_time,
|
||||||
|
isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
|
||||||
now.setHours(h);
|
now.setHours(h);
|
||||||
h = parseInt(now.getHours(), 10);
|
h = parseInt(now.getHours(), 10);
|
||||||
now.setMinutes(m);
|
now.setMinutes(m);
|
||||||
@ -1701,9 +1703,12 @@
|
|||||||
|
|
||||||
current_time = new Date(_xdsoft_datetime.currentTime);
|
current_time = new Date(_xdsoft_datetime.currentTime);
|
||||||
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
|
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
|
||||||
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
|
|
||||||
|
if (!isALlowTimesInit) {
|
||||||
|
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
|
||||||
|
}
|
||||||
|
|
||||||
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) {
|
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
|
||||||
if (options.defaultSelect || datetimepicker.data('changed')) {
|
if (options.defaultSelect || datetimepicker.data('changed')) {
|
||||||
classes.push('xdsoft_current');
|
classes.push('xdsoft_current');
|
||||||
} else if (options.initTime) {
|
} else if (options.initTime) {
|
||||||
|
2
jquery.datetimepicker.min.js
vendored
Normal file
2
jquery.datetimepicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
|||||||
"main": "jquery.datetimepicker.js",
|
"main": "jquery.datetimepicker.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"concat": "bower update && concat-cli -f jquery.datetimepicker.js bower_components/jquery-mousewheel/jquery.mousewheel.js bower_components/date-functions/date-functions.js -o build/jquery.datetimepicker.full.js",
|
"concat": "concat-cli -f jquery.datetimepicker.js bower_components/jquery-mousewheel/jquery.mousewheel.js bower_components/date-functions/date-functions.js -o build/jquery.datetimepicker.full.js",
|
||||||
"minify": "uglifyjs jquery.datetimepicker.js -c -m -o build/jquery.datetimepicker.min.js",
|
"minify": "uglifyjs jquery.datetimepicker.js -c -m -o build/jquery.datetimepicker.min.js",
|
||||||
"minifyconcat": "uglifyjs build/jquery.datetimepicker.full.js -c -m -o build/jquery.datetimepicker.full.min.js",
|
"minifyconcat": "uglifyjs build/jquery.datetimepicker.full.js -c -m -o build/jquery.datetimepicker.full.min.js",
|
||||||
"build": "npm run minify && npm run concat && npm run minifyconcat"
|
"build": "npm run minify && npm run concat && npm run minifyconcat"
|
||||||
|
Loading…
Reference in New Issue
Block a user