Fix inverted scrolling issue for date selectors

This commit is contained in:
Nicholas Moen 2022-01-07 16:22:41 -07:00
parent bb372ec424
commit ac83979ed0
4 changed files with 39 additions and 19 deletions

View File

@ -90,7 +90,7 @@ var datetimepickerFactory = function ($) {
'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
],
dayOfWeekShort: [
"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
],
dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
},
@ -541,6 +541,15 @@ var datetimepickerFactory = function ($) {
"კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ"
],
dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"]
},
kk: { // Kazakh
months: [
'Қаңтар', 'Ақпан', 'Наурыз', 'Сәуір', 'Мамыр', 'Маусым', 'Шілде', 'Тамыз', 'Қыркүйек', 'Қазан', 'Қараша', 'Желтоқсан'
],
dayOfWeekShort: [
"Жк", "Дс", "Сс", "Ср", "Бс", "Жм", "Сб"
],
dayOfWeek: ["Жексенбі", "Дүйсенбі", "Сейсенбі", "Сәрсенбі", "Бейсенбі", "Жұма", "Сенбі"]
}
},
@ -806,7 +815,7 @@ var datetimepickerFactory = function ($) {
deltaY *= 10;
if ('deltaY' in e) { deltaY = e.deltaY; }
if ('deltaY' in e) { deltaY = -e.deltaY; }
if (deltaY && e.deltaMode) {
if (e.deltaMode === 1) {
@ -1646,7 +1655,18 @@ var datetimepickerFactory = function ($) {
var pheight = timeboxparent[0].clientHeight,
height = timebox[0].offsetHeight,
top = Math.abs(parseInt(timebox.css('marginTop'), 10));
if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
/**
* Fixes a bug which happens if:
* top is < the timeHeightInTimePicker, it will cause the up arrow to stop working
* same for the down arrow if it's not exactly on the pixel
*/
if (top < options.timeHeightInTimePicker) {
top = options.timeHeightInTimePicker;
} else if ($this.hasClass(options.next) && (height - pheight) < top) {
timebox.css('marginTop', '-' + height + 'px');
}
if ($this.hasClass(options.next) && (height - pheight) > top) {
timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
@ -1685,7 +1705,7 @@ var datetimepickerFactory = function ($) {
clearTimeout(xchangeTimer);
xchangeTimer = setTimeout(function () {
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null || isNaN(_xdsoft_datetime.currentTime.getTime())) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -805,7 +805,7 @@ var datetimepickerFactory = function ($) {
deltaY *= 10;
if ('deltaY' in e) { deltaY = e.deltaY; }
if ('deltaY' in e) { deltaY = -e.deltaY; }
if (deltaY && e.deltaMode) {
if (e.deltaMode === 1) {