mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
commit
010a78c564
@ -1,8 +1,10 @@
|
||||
/*!
|
||||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2015
|
||||
* @version 1.3.3
|
||||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2017
|
||||
* @version 1.3.4
|
||||
*
|
||||
* Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
|
||||
* This library is a standalone javascript library and does not depend on other libraries or plugins like jQuery.
|
||||
*
|
||||
* @see http://php.net/manual/en/function.date.php
|
||||
*
|
||||
* For more JQuery plugins visit http://plugins.krajee.com
|
||||
@ -12,15 +14,16 @@ var DateFormatter;
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var _compare, _lpad, _extend, defaultSettings, DAY, HOUR;
|
||||
var _compare, _lpad, _extend, _indexOf, defaultSettings, DAY, HOUR;
|
||||
DAY = 1000 * 60 * 60 * 24;
|
||||
HOUR = 3600;
|
||||
|
||||
_compare = function (str1, str2) {
|
||||
return typeof(str1) === 'string' && typeof(str2) === 'string' && str1.toLowerCase() === str2.toLowerCase();
|
||||
};
|
||||
_lpad = function (value, length, char) {
|
||||
var chr = char || '0', val = value.toString();
|
||||
_lpad = function (value, length, chr) {
|
||||
var val = value.toString();
|
||||
chr = chr || '0';
|
||||
return val.length < length ? _lpad(chr + val, length) : val;
|
||||
};
|
||||
_extend = function (out) {
|
||||
@ -43,6 +46,14 @@ var DateFormatter;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
_indexOf = function (val, arr) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (arr[i].toLowerCase() === val.toLowerCase()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
defaultSettings = {
|
||||
dateSettings: {
|
||||
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
||||
@ -77,25 +88,35 @@ var DateFormatter;
|
||||
|
||||
DateFormatter.prototype = {
|
||||
constructor: DateFormatter,
|
||||
getMonth: function (val) {
|
||||
var self = this, i;
|
||||
i = _indexOf(val, self.dateSettings.monthsShort) + 1;
|
||||
if (i === 0) {
|
||||
i = _indexOf(val, self.dateSettings.months) + 1;
|
||||
}
|
||||
return i;
|
||||
},
|
||||
parseDate: function (vDate, vFormat) {
|
||||
var self = this, vFormatParts, vDateParts, i, vDateFlag = false, vTimeFlag = false, vDatePart, iDatePart,
|
||||
vSettings = self.dateSettings, vMonth, vMeriIndex, vMeriOffset, len, mer,
|
||||
out = {date: null, year: null, month: null, day: null, hour: 0, min: 0, sec: 0};
|
||||
if (!vDate) {
|
||||
return undefined;
|
||||
return null;
|
||||
}
|
||||
if (vDate instanceof Date) {
|
||||
return vDate;
|
||||
}
|
||||
if (typeof vDate === 'number') {
|
||||
return new Date(vDate);
|
||||
}
|
||||
if (vFormat === 'U') {
|
||||
i = parseInt(vDate);
|
||||
return i ? new Date(i * 1000) : vDate;
|
||||
}
|
||||
if (typeof vDate !== 'string') {
|
||||
return '';
|
||||
switch (typeof vDate) {
|
||||
case 'number':
|
||||
return new Date(vDate);
|
||||
case 'string':
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
vFormatParts = vFormat.match(self.validParts);
|
||||
if (!vFormatParts || vFormatParts.length === 0) {
|
||||
@ -108,11 +129,11 @@ var DateFormatter;
|
||||
switch (vFormatParts[i]) {
|
||||
case 'y':
|
||||
case 'Y':
|
||||
if (iDatePart) {
|
||||
len = vDatePart.length;
|
||||
if (len === 2) {
|
||||
out.year = parseInt((iDatePart < 70 ? '20' : '19') + vDatePart);
|
||||
} else if (len === 4) {
|
||||
out.year = iDatePart;
|
||||
out.year = len === 2 ? parseInt((iDatePart < 70 ? '20' : '19') + vDatePart) : iDatePart;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
vDateFlag = true;
|
||||
break;
|
||||
@ -120,18 +141,18 @@ var DateFormatter;
|
||||
case 'n':
|
||||
case 'M':
|
||||
case 'F':
|
||||
if (isNaN(vDatePart)) {
|
||||
vMonth = vSettings.monthsShort.indexOf(vDatePart);
|
||||
if (vMonth > -1) {
|
||||
out.month = vMonth + 1;
|
||||
}
|
||||
vMonth = vSettings.months.indexOf(vDatePart);
|
||||
if (vMonth > -1) {
|
||||
out.month = vMonth + 1;
|
||||
if (isNaN(iDatePart)) {
|
||||
vMonth = self.getMonth(vDatePart);
|
||||
if (vMonth > 0) {
|
||||
out.month = vMonth;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (iDatePart >= 1 && iDatePart <= 12) {
|
||||
out.month = iDatePart;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
vDateFlag = true;
|
||||
@ -140,6 +161,8 @@ var DateFormatter;
|
||||
case 'j':
|
||||
if (iDatePart >= 1 && iDatePart <= 31) {
|
||||
out.day = iDatePart;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
vDateFlag = true;
|
||||
break;
|
||||
@ -148,16 +171,22 @@ var DateFormatter;
|
||||
vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') :
|
||||
(vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1;
|
||||
mer = vDateParts[vMeriIndex];
|
||||
if (vMeriIndex > -1) {
|
||||
if (vMeriIndex !== -1) {
|
||||
vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 :
|
||||
(_compare(mer, vSettings.meridiem[1]) ? 12 : -1);
|
||||
if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset > -1) {
|
||||
out.hour = iDatePart + vMeriOffset;
|
||||
} else if (iDatePart >= 0 && iDatePart <= 23) {
|
||||
if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset !== -1) {
|
||||
out.hour = iDatePart % 12 === 0 ? vMeriOffset : iDatePart + vMeriOffset;
|
||||
} else {
|
||||
if (iDatePart >= 0 && iDatePart <= 23) {
|
||||
out.hour = iDatePart;
|
||||
}
|
||||
} else if (iDatePart >= 0 && iDatePart <= 23) {
|
||||
}
|
||||
} else {
|
||||
if (iDatePart >= 0 && iDatePart <= 23) {
|
||||
out.hour = iDatePart;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
vTimeFlag = true;
|
||||
break;
|
||||
@ -165,18 +194,24 @@ var DateFormatter;
|
||||
case 'H':
|
||||
if (iDatePart >= 0 && iDatePart <= 23) {
|
||||
out.hour = iDatePart;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
vTimeFlag = true;
|
||||
break;
|
||||
case 'i':
|
||||
if (iDatePart >= 0 && iDatePart <= 59) {
|
||||
out.min = iDatePart;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
vTimeFlag = true;
|
||||
break;
|
||||
case 's':
|
||||
if (iDatePart >= 0 && iDatePart <= 59) {
|
||||
out.sec = iDatePart;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
vTimeFlag = true;
|
||||
break;
|
||||
@ -186,7 +221,7 @@ var DateFormatter;
|
||||
out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0);
|
||||
} else {
|
||||
if (vTimeFlag !== true) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
out.date = new Date(0, 0, 0, out.hour, out.min, out.sec, 0);
|
||||
}
|
||||
@ -196,8 +231,8 @@ var DateFormatter;
|
||||
if (typeof vDateStr !== 'string') {
|
||||
return vDateStr;
|
||||
}
|
||||
var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g,
|
||||
vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, iPart, iSec;
|
||||
var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g, len,
|
||||
vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, n, iPart, iSec;
|
||||
|
||||
if (!vPattern.test(vFormatParts[0])) {
|
||||
return vDateStr;
|
||||
@ -207,6 +242,9 @@ var DateFormatter;
|
||||
vDigit = 2;
|
||||
iPart = vParts[i];
|
||||
iSec = parseInt(iPart.substr(0, 2));
|
||||
if (isNaN(iSec)) {
|
||||
return null;
|
||||
}
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
|
||||
@ -224,13 +262,13 @@ var DateFormatter;
|
||||
break;
|
||||
case 2:
|
||||
vYear = vDate.getFullYear();
|
||||
if (iPart.length < 4) {
|
||||
vDate.setFullYear(parseInt(vYear.toString().substr(0, 4 - iPart.length) + iPart));
|
||||
vDigit = iPart.length;
|
||||
} else {
|
||||
vDate.setFullYear = parseInt(iPart.substr(0, 4));
|
||||
vDigit = 4;
|
||||
len = iPart.length;
|
||||
vDigit = len < 4 ? len : 4;
|
||||
vYear = parseInt(len < 4 ? vYear.toString().substr(0, 4 - len) + iPart : iPart.substr(0, 4));
|
||||
if (!vYear) {
|
||||
return null;
|
||||
}
|
||||
vDate.setFullYear(vYear);
|
||||
break;
|
||||
case 3:
|
||||
vDate.setHours(iSec);
|
||||
@ -242,14 +280,15 @@ var DateFormatter;
|
||||
vDate.setSeconds(iSec);
|
||||
break;
|
||||
}
|
||||
if (iPart.substr(vDigit).length > 0) {
|
||||
vParts.splice(i + 1, 0, iPart.substr(vDigit));
|
||||
n = iPart.substr(vDigit);
|
||||
if (n.length > 0) {
|
||||
vParts.splice(i + 1, 0, n);
|
||||
}
|
||||
}
|
||||
return vDate;
|
||||
},
|
||||
parseFormat: function (vChar, vDate) {
|
||||
var self = this, vSettings = self.dateSettings, fmt, backspace = /\\?(.?)/gi, doFormat = function (t, s) {
|
||||
var self = this, vSettings = self.dateSettings, fmt, backslash = /\\?(.?)/gi, doFormat = function (t, s) {
|
||||
return fmt[t] ? fmt[t]() : s;
|
||||
};
|
||||
fmt = {
|
||||
@ -479,14 +518,6 @@ var DateFormatter;
|
||||
var str = /\((.*)\)/.exec(String(vDate))[1];
|
||||
return str || 'Coordinated Universal Time';
|
||||
},
|
||||
/**
|
||||
* Timezone abbreviation: `e.g. EST, MDT, ...`
|
||||
* @return {string}
|
||||
*/
|
||||
T: function () {
|
||||
var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
|
||||
return str || 'UTC';
|
||||
},
|
||||
/**
|
||||
* DST observed? `0 or 1`
|
||||
* @return {number}
|
||||
@ -512,6 +543,14 @@ var DateFormatter;
|
||||
var O = fmt.O();
|
||||
return (O.substr(0, 3) + ':' + O.substr(3, 2));
|
||||
},
|
||||
/**
|
||||
* Timezone abbreviation: `e.g. EST, MDT, ...`
|
||||
* @return {string}
|
||||
*/
|
||||
T: function () {
|
||||
var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
|
||||
return str || 'UTC';
|
||||
},
|
||||
/**
|
||||
* Timezone offset in seconds: `-43200...50400`
|
||||
* @return {number}
|
||||
@ -528,14 +567,14 @@ var DateFormatter;
|
||||
* @return {string}
|
||||
*/
|
||||
c: function () {
|
||||
return 'Y-m-d\\TH:i:sP'.replace(backspace, doFormat);
|
||||
return 'Y-m-d\\TH:i:sP'.replace(backslash, doFormat);
|
||||
},
|
||||
/**
|
||||
* RFC 2822 date
|
||||
* @return {string}
|
||||
*/
|
||||
r: function () {
|
||||
return 'D, d M Y H:i:s O'.replace(backspace, doFormat);
|
||||
return 'D, d M Y H:i:s O'.replace(backslash, doFormat);
|
||||
},
|
||||
/**
|
||||
* Seconds since UNIX epoch
|
||||
@ -548,23 +587,27 @@ var DateFormatter;
|
||||
return doFormat(vChar, vChar);
|
||||
},
|
||||
formatDate: function (vDate, vFormat) {
|
||||
var self = this, i, n, len, str, vChar, vDateStr = '';
|
||||
var self = this, i, n, len, str, vChar, vDateStr = '', BACKSLASH = '\\';
|
||||
if (typeof vDate === 'string') {
|
||||
vDate = self.parseDate(vDate, vFormat);
|
||||
if (vDate === false) {
|
||||
return false;
|
||||
if (!vDate) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (vDate instanceof Date) {
|
||||
len = vFormat.length;
|
||||
for (i = 0; i < len; i++) {
|
||||
vChar = vFormat.charAt(i);
|
||||
if (vChar === 'S') {
|
||||
if (vChar === 'S' || vChar === BACKSLASH) {
|
||||
continue;
|
||||
}
|
||||
if (i > 0 && vFormat.charAt(i - 1) === BACKSLASH) {
|
||||
vDateStr += vChar;
|
||||
continue;
|
||||
}
|
||||
str = self.parseFormat(vChar, vDate);
|
||||
if (i !== (len - 1) && self.intParts.test(vChar) && vFormat.charAt(i + 1) === 'S') {
|
||||
n = parseInt(str);
|
||||
n = parseInt(str) || 0;
|
||||
str += self.dateSettings.ordinal(n);
|
||||
}
|
||||
vDateStr += str;
|
||||
@ -574,7 +617,8 @@ var DateFormatter;
|
||||
return '';
|
||||
}
|
||||
};
|
||||
})();/**
|
||||
})();
|
||||
/**
|
||||
* @preserve jQuery DateTimePicker plugin v2.5.4
|
||||
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
||||
* @author Chupurnov Valeriy (<chupurnov@gmail.com>)
|
||||
@ -593,9 +637,6 @@ var DateFormatter;
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
var currentlyScrollingTimeDiv = false;
|
||||
|
||||
var default_options = {
|
||||
i18n: {
|
||||
ar: { // Arabic
|
||||
@ -775,6 +816,13 @@ var DateFormatter;
|
||||
dayOfWeekShort: [
|
||||
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
|
||||
]
|
||||
},
|
||||
km: { // Khmer
|
||||
months: [
|
||||
"មករា", "កុម្ភៈ", "មិនា", "មេសា", "ឧសភា", "មិថុនា", "កក្កដា", "សីហា", "កញ្ញា", "តុលា", "វិច្ឋិកា", "ធ្នូ"
|
||||
],
|
||||
dayOfWeekShort: ["អាទិ", "ចន្ទ", "អង្គារ", "ពុធ", "ព្រហ", "សុក្រ", "សៅរ៍"],
|
||||
dayOfWeek: ["អាទិត្យ", "ចន្ទ", "អង្គារ", "ពុធ", "ព្រហស្បតិ៍", "សុក្រ", "សៅរ៍"]
|
||||
},
|
||||
kr: { // Korean
|
||||
months: [
|
||||
@ -1102,8 +1150,12 @@ var DateFormatter;
|
||||
"კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ"
|
||||
],
|
||||
dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"]
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
ownerDocument: document,
|
||||
contentWindow: window,
|
||||
|
||||
value: '',
|
||||
rtl: false,
|
||||
|
||||
@ -1209,12 +1261,14 @@ var DateFormatter;
|
||||
days: locale.dayOfWeek,
|
||||
daysShort: locale.dayOfWeekShort,
|
||||
months: locale.months,
|
||||
monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }),
|
||||
monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) })
|
||||
};
|
||||
|
||||
if (typeof DateFormatter === 'function') {
|
||||
dateHelper = new DateFormatter({
|
||||
dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// for locale settings
|
||||
@ -1275,7 +1329,7 @@ var DateFormatter;
|
||||
Date.prototype.countDaysInMonth = function () {
|
||||
return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
|
||||
};
|
||||
$.fn.xdsoftScroller = function (percent) {
|
||||
$.fn.xdsoftScroller = function (options, percent) {
|
||||
return this.each(function () {
|
||||
var timeboxparent = $(this),
|
||||
pointerEventToXY = function (e) {
|
||||
@ -1339,15 +1393,15 @@ var DateFormatter;
|
||||
h1 = scrollbar[0].offsetHeight;
|
||||
|
||||
if (event.type === 'mousedown' || event.type === 'touchstart') {
|
||||
if (document) {
|
||||
$(document.body).addClass('xdsoft_noselect');
|
||||
if (options.ownerDocument) {
|
||||
$(options.ownerDocument.body).addClass('xdsoft_noselect');
|
||||
}
|
||||
$([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
|
||||
$([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
|
||||
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
|
||||
$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
|
||||
.off('mousemove.xdsoft_scroller', calcOffset)
|
||||
.removeClass('xdsoft_noselect');
|
||||
});
|
||||
$(document.body).on('mousemove.xdsoft_scroller', calcOffset);
|
||||
$(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset);
|
||||
} else {
|
||||
touchStart = true;
|
||||
event.stopPropagation();
|
||||
@ -1556,14 +1610,14 @@ var DateFormatter;
|
||||
}
|
||||
}
|
||||
|
||||
select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
|
||||
select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
});
|
||||
|
||||
month_picker
|
||||
.find('.xdsoft_select')
|
||||
.xdsoftScroller()
|
||||
.xdsoftScroller(options)
|
||||
.on('touchstart mousedown.xdsoft', function (event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
@ -1725,7 +1779,7 @@ var DateFormatter;
|
||||
}
|
||||
|
||||
if (!options.timepickerScrollbar) {
|
||||
timeboxparent.xdsoftScroller('hide');
|
||||
timeboxparent.xdsoftScroller(options, 'hide');
|
||||
}
|
||||
|
||||
if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
|
||||
@ -1802,10 +1856,10 @@ var DateFormatter;
|
||||
|
||||
//scroll_element = timepicker.find('.xdsoft_time_box');
|
||||
timeboxparent.append(timebox);
|
||||
timeboxparent.xdsoftScroller();
|
||||
timeboxparent.xdsoftScroller(options);
|
||||
|
||||
datetimepicker.on('afterOpen.xdsoft', function () {
|
||||
timeboxparent.xdsoftScroller();
|
||||
timeboxparent.xdsoftScroller(options);
|
||||
});
|
||||
|
||||
datetimepicker
|
||||
@ -2063,10 +2117,10 @@ var DateFormatter;
|
||||
}
|
||||
}(500));
|
||||
|
||||
$([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() {
|
||||
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() {
|
||||
clearTimeout(timer);
|
||||
stop = true;
|
||||
$([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2);
|
||||
$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2);
|
||||
});
|
||||
});
|
||||
|
||||
@ -2105,10 +2159,10 @@ var DateFormatter;
|
||||
timer = setTimeout(arguments_callee4, v || period);
|
||||
}
|
||||
}(500));
|
||||
$([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() {
|
||||
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() {
|
||||
clearTimeout(timer);
|
||||
stop = true;
|
||||
$([document.body, window])
|
||||
$([options.ownerDocument.body, options.contentWindow])
|
||||
.off('touchend mouseup.xdsoft', arguments_callee5);
|
||||
});
|
||||
});
|
||||
@ -2413,13 +2467,8 @@ var DateFormatter;
|
||||
});
|
||||
|
||||
timebox
|
||||
.on('touchmove', 'div', function () { currentlyScrollingTimeDiv = true; })
|
||||
.on('touchend click.xdsoft', 'div', function (xdevent) {
|
||||
xdevent.stopPropagation();
|
||||
if (currentlyScrollingTimeDiv) {
|
||||
currentlyScrollingTimeDiv = false;
|
||||
return;
|
||||
}
|
||||
var $this = $(this),
|
||||
currentTime = _xdsoft_datetime.currentTime;
|
||||
|
||||
@ -2558,11 +2607,11 @@ var DateFormatter;
|
||||
left = dateInputOffset.left;
|
||||
position = "absolute";
|
||||
|
||||
windowWidth = $(window).width();
|
||||
windowHeight = $(window).height();
|
||||
windowScrollTop = $(window).scrollTop();
|
||||
windowWidth = $(options.contentWindow).width();
|
||||
windowHeight = $(options.contentWindow).height();
|
||||
windowScrollTop = $(options.contentWindow).scrollTop();
|
||||
|
||||
if ((document.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
|
||||
if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
|
||||
var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
|
||||
left = left - diff;
|
||||
}
|
||||
@ -2573,13 +2622,13 @@ var DateFormatter;
|
||||
|
||||
if (options.fixed) {
|
||||
verticalPosition -= windowScrollTop;
|
||||
left -= $(window).scrollLeft();
|
||||
left -= $(options.contentWindow).scrollLeft();
|
||||
position = "fixed";
|
||||
} else {
|
||||
dateInputHasFixedAncestor = false;
|
||||
|
||||
forEachAncestorOf(dateInputElem, function (ancestorNode) {
|
||||
if (window.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
|
||||
if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
|
||||
dateInputHasFixedAncestor = true;
|
||||
return false;
|
||||
}
|
||||
@ -2615,7 +2664,7 @@ var DateFormatter;
|
||||
forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
|
||||
var ancestorNodePosition;
|
||||
|
||||
ancestorNodePosition = window.getComputedStyle(ancestorNode).getPropertyValue('position');
|
||||
ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position');
|
||||
|
||||
if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
|
||||
left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
|
||||
@ -2644,14 +2693,14 @@ var DateFormatter;
|
||||
if (onShow !== false) {
|
||||
datetimepicker.show();
|
||||
setPos();
|
||||
$(window)
|
||||
$(options.contentWindow)
|
||||
.off('resize.xdsoft', setPos)
|
||||
.on('resize.xdsoft', setPos);
|
||||
|
||||
if (options.closeOnWithoutClick) {
|
||||
$([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
|
||||
$([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
|
||||
datetimepicker.trigger('close.xdsoft');
|
||||
$([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6);
|
||||
$([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -2725,8 +2774,8 @@ var DateFormatter;
|
||||
},
|
||||
getCaretPos = function (input) {
|
||||
try {
|
||||
if (document.selection && document.selection.createRange) {
|
||||
var range = document.selection.createRange();
|
||||
if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
|
||||
var range = options.ownerDocument.selection.createRange();
|
||||
return range.getBookmark().charCodeAt(2) - 2;
|
||||
}
|
||||
if (input.setSelectionRange) {
|
||||
@ -2737,7 +2786,7 @@ var DateFormatter;
|
||||
}
|
||||
},
|
||||
setCaretPos = function (node, pos) {
|
||||
node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
|
||||
node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
@ -2888,14 +2937,14 @@ var DateFormatter;
|
||||
input
|
||||
.data('xdsoft_datetimepicker', null)
|
||||
.off('.xdsoft');
|
||||
$(window).off('resize.xdsoft');
|
||||
$([window, document.body]).off('mousedown.xdsoft touchstart');
|
||||
$(options.contentWindow).off('resize.xdsoft');
|
||||
$([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart');
|
||||
if (input.unmousewheel) {
|
||||
input.unmousewheel();
|
||||
}
|
||||
}
|
||||
};
|
||||
$(document)
|
||||
$(options.ownerDocument)
|
||||
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
|
||||
.on('keydown.xdsoftctrl', function (e) {
|
||||
if (e.keyCode === CTRLKEY) {
|
||||
@ -2969,6 +3018,7 @@ var DateFormatter;
|
||||
this.style = style;
|
||||
}
|
||||
}));
|
||||
|
||||
/*!
|
||||
* jQuery Mousewheel 3.1.13
|
||||
*
|
||||
|
4
build/jquery.datetimepicker.full.min.js
vendored
4
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
@ -196,6 +196,13 @@
|
||||
dayOfWeekShort: [
|
||||
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
|
||||
]
|
||||
},
|
||||
km: { // Khmer
|
||||
months: [
|
||||
"មករា", "កុម្ភៈ", "មិនា", "មេសា", "ឧសភា", "មិថុនា", "កក្កដា", "សីហា", "កញ្ញា", "តុលា", "វិច្ឋិកា", "ធ្នូ"
|
||||
],
|
||||
dayOfWeekShort: ["អាទិ", "ចន្ទ", "អង្គារ", "ពុធ", "ព្រហ", "សុក្រ", "សៅរ៍"],
|
||||
dayOfWeek: ["អាទិត្យ", "ចន្ទ", "អង្គារ", "ពុធ", "ព្រហស្បតិ៍", "សុក្រ", "សៅរ៍"]
|
||||
},
|
||||
kr: { // Korean
|
||||
months: [
|
||||
|
208
yarn.lock
Normal file
208
yarn.lock
Normal file
@ -0,0 +1,208 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
amdefine@>=0.0.4:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
|
||||
|
||||
ansi-regex@^2.0.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
||||
|
||||
ansi-styles@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
||||
|
||||
async@~0.2.6:
|
||||
version "0.2.10"
|
||||
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
|
||||
|
||||
camelcase@^2.0.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
|
||||
|
||||
chalk@^1.1.1:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
||||
dependencies:
|
||||
ansi-styles "^2.2.1"
|
||||
escape-string-regexp "^1.0.2"
|
||||
has-ansi "^2.0.0"
|
||||
strip-ansi "^3.0.0"
|
||||
supports-color "^2.0.0"
|
||||
|
||||
cliui@^3.0.3:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
|
||||
dependencies:
|
||||
string-width "^1.0.1"
|
||||
strip-ansi "^3.0.1"
|
||||
wrap-ansi "^2.0.0"
|
||||
|
||||
code-point-at@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
|
||||
|
||||
commander@^2.9.0:
|
||||
version "2.9.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
|
||||
dependencies:
|
||||
graceful-readlink ">= 1.0.0"
|
||||
|
||||
concat-cli@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/concat-cli/-/concat-cli-4.0.0.tgz#a73a0fb0d18b25804ebe703bcc35922324dbf74d"
|
||||
dependencies:
|
||||
chalk "^1.1.1"
|
||||
concat "^1.0.0"
|
||||
yargs "^3.30.0"
|
||||
|
||||
concat@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/concat/-/concat-1.0.3.tgz#40f3353089d65467695cb1886b45edd637d8cca8"
|
||||
dependencies:
|
||||
commander "^2.9.0"
|
||||
|
||||
concat@azer/concat:
|
||||
version "1.0.0"
|
||||
resolved "https://codeload.github.com/azer/concat/tar.gz/c64c5cbc2e60b0bc1a8f4bceafed661f66f19dcf"
|
||||
dependencies:
|
||||
parallel-loop azer/parallel-loop
|
||||
serial-loop azer/serial-loop
|
||||
|
||||
decamelize@^1.1.1:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
|
||||
escape-string-regexp@^1.0.2:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
|
||||
"graceful-readlink@>= 1.0.0":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725"
|
||||
|
||||
has-ansi@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
|
||||
dependencies:
|
||||
ansi-regex "^2.0.0"
|
||||
|
||||
invert-kv@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
|
||||
|
||||
is-fullwidth-code-point@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb"
|
||||
dependencies:
|
||||
number-is-nan "^1.0.0"
|
||||
|
||||
"jquery-mousewheel@>= 3.1.13":
|
||||
version "3.1.13"
|
||||
resolved "https://registry.yarnpkg.com/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz#06f0335f16e353a695e7206bf50503cb523a6ee5"
|
||||
|
||||
"jquery@>= 1.7.2":
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"
|
||||
|
||||
lcid@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835"
|
||||
dependencies:
|
||||
invert-kv "^1.0.0"
|
||||
|
||||
number-is-nan@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
|
||||
|
||||
os-locale@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9"
|
||||
dependencies:
|
||||
lcid "^1.0.0"
|
||||
|
||||
parallel-loop@azer/parallel-loop:
|
||||
version "0.0.2"
|
||||
resolved "https://codeload.github.com/azer/parallel-loop/tar.gz/054b0d3fe633483a3a6b94104c8343473208d5fb"
|
||||
|
||||
"php-date-formatter@>= 1.3.3":
|
||||
version "1.3.4"
|
||||
resolved "https://registry.yarnpkg.com/php-date-formatter/-/php-date-formatter-1.3.4.tgz#09a15ae0766ba0beb1900c27c1ec319ef2e4563e"
|
||||
|
||||
serial-loop@azer/serial-loop:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/azer/serial-loop/tar.gz/99c6271f80f075b7db089a1aadc7178a310a4570"
|
||||
|
||||
source-map@0.1.34:
|
||||
version "0.1.34"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.34.tgz#a7cfe89aec7b1682c3b198d0acfb47d7d090566b"
|
||||
dependencies:
|
||||
amdefine ">=0.0.4"
|
||||
|
||||
string-width@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
|
||||
dependencies:
|
||||
code-point-at "^1.0.0"
|
||||
is-fullwidth-code-point "^1.0.0"
|
||||
strip-ansi "^3.0.0"
|
||||
|
||||
strip-ansi@^3.0.0, strip-ansi@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
|
||||
dependencies:
|
||||
ansi-regex "^2.0.0"
|
||||
|
||||
supports-color@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
||||
|
||||
uglify-to-browserify@~1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
|
||||
|
||||
uglifycss@0.0.20:
|
||||
version "0.0.20"
|
||||
resolved "https://registry.yarnpkg.com/uglifycss/-/uglifycss-0.0.20.tgz#0f953c3cf989f9ff7447cba24f9999687c9a5910"
|
||||
|
||||
uglifyjs@^2.4.10:
|
||||
version "2.4.10"
|
||||
resolved "https://registry.yarnpkg.com/uglifyjs/-/uglifyjs-2.4.10.tgz#632927319fa6a3da3fc91f9773ac27bfe6c3ee92"
|
||||
dependencies:
|
||||
async "~0.2.6"
|
||||
source-map "0.1.34"
|
||||
uglify-to-browserify "~1.0.0"
|
||||
yargs "~1.3.3"
|
||||
|
||||
window-size@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"
|
||||
|
||||
wrap-ansi@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
|
||||
dependencies:
|
||||
string-width "^1.0.1"
|
||||
strip-ansi "^3.0.1"
|
||||
|
||||
y18n@^3.2.0:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
|
||||
|
||||
yargs@^3.30.0:
|
||||
version "3.32.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995"
|
||||
dependencies:
|
||||
camelcase "^2.0.1"
|
||||
cliui "^3.0.3"
|
||||
decamelize "^1.1.1"
|
||||
os-locale "^1.4.0"
|
||||
string-width "^1.0.1"
|
||||
window-size "^0.1.4"
|
||||
y18n "^3.2.0"
|
||||
|
||||
yargs@~1.3.3:
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-1.3.3.tgz#054de8b61f22eefdb7207059eaef9d6b83fb931a"
|
Loading…
Reference in New Issue
Block a user