/*! * @copyright copyright © kartik visweswaran, krajee.com, 2014 - 2015 * @version 1.3.3 * * date formatter utility library that allows formatting date/time variables or date objects using php datetime format. * @see http://php.net/manual/en/function.date.php * * for more jquery plugins visit http://plugins.krajee.com * for more yii related demos visit http://demos.krajee.com */ var dateformatter; (function () { "use strict"; var _compare, _lpad, _extend, 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(); return val.length < length ? _lpad(chr + val, length) : val; }; _extend = function (out) { var i, obj; out = out || {}; for (i = 1; i < arguments.length; i++) { obj = arguments[i]; if (!obj) { continue; } for (var key in obj) { if (obj.hasownproperty(key)) { if (typeof obj[key] === 'object') { _extend(out[key], obj[key]); } else { out[key] = obj[key]; } } } } return out; }; defaultsettings = { datesettings: { days: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'], daysshort: ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'], months: [ 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december' ], monthsshort: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'], meridiem: ['am', 'pm'], ordinal: function (number) { var n = number % 10, suffixes = {1: 'st', 2: 'nd', 3: 'rd'}; return math.floor(number % 100 / 10) === 1 || !suffixes[n] ? 'th' : suffixes[n]; } }, separators: /[ \-+\/\.t:@]/g, validparts: /[ddjlnswzwfmmntloyyaabgghhisuetiopzcru]/g, intparts: /[djwnzmnyyhhggis]/g, tzparts: /\b(?:[pmcea][sdp]t|(?:pacific|mountain|central|eastern|atlantic) (?:standard|daylight|prevailing) time|(?:gmt|utc)(?:[-+]\d{4})?)\b/g, tzclip: /[^-+\da-z]/g }; dateformatter = function (options) { var self = this, config = _extend(defaultsettings, options); self.datesettings = config.datesettings; self.separators = config.separators; self.validparts = config.validparts; self.intparts = config.intparts; self.tzparts = config.tzparts; self.tzclip = config.tzclip; }; dateformatter.prototype = { constructor: dateformatter, 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; } 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 ''; } vformatparts = vformat.match(self.validparts); if (!vformatparts || vformatparts.length === 0) { throw new error("invalid date format definition."); } vdateparts = vdate.replace(self.separators, '\0').split('\0'); for (i = 0; i < vdateparts.length; i++) { vdatepart = vdateparts[i]; idatepart = parseint(vdatepart); switch (vformatparts[i]) { case 'y': case 'y': len = vdatepart.length; if (len === 2) { out.year = parseint((idatepart < 70 ? '20' : '19') + vdatepart); } else if (len === 4) { out.year = idatepart; } vdateflag = true; break; case 'm': 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; } } else { if (idatepart >= 1 && idatepart <= 12) { out.month = idatepart; } } vdateflag = true; break; case 'd': case 'j': if (idatepart >= 1 && idatepart <= 31) { out.day = idatepart; } vdateflag = true; break; case 'g': case 'h': vmeriindex = (vformatparts.indexof('a') > -1) ? vformatparts.indexof('a') : (vformatparts.indexof('a') > -1) ? vformatparts.indexof('a') : -1; mer = vdateparts[vmeriindex]; 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 - 1; } else if (idatepart >= 0 && idatepart <= 23) { out.hour = idatepart; } } else if (idatepart >= 0 && idatepart <= 23) { out.hour = idatepart; } vtimeflag = true; break; case 'g': case 'h': if (idatepart >= 0 && idatepart <= 23) { out.hour = idatepart; } vtimeflag = true; break; case 'i': if (idatepart >= 0 && idatepart <= 59) { out.min = idatepart; } vtimeflag = true; break; case 's': if (idatepart >= 0 && idatepart <= 59) { out.sec = idatepart; } vtimeflag = true; break; } } if (vdateflag === true && out.year && out.month && out.day) { out.date = new date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0); } else { if (vtimeflag !== true) { return false; } out.date = new date(0, 0, 0, out.hour, out.min, out.sec, 0); } return out.date; }, guessdate: function (vdatestr, vformat) { 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; if (!vpattern.test(vformatparts[0])) { return vdatestr; } for (i = 0; i < vparts.length; i++) { vdigit = 2; ipart = vparts[i]; isec = parseint(ipart.substr(0, 2)); switch (i) { case 0: if (vformatparts[0] === 'm' || vformatparts[0] === 'n') { vdate.setmonth(isec - 1); } else { vdate.setdate(isec); } break; case 1: if (vformatparts[0] === 'm' || vformatparts[0] === 'n') { vdate.setdate(isec); } else { vdate.setmonth(isec - 1); } 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; } break; case 3: vdate.sethours(isec); break; case 4: vdate.setminutes(isec); break; case 5: vdate.setseconds(isec); break; } if (ipart.substr(vdigit).length > 0) { vparts.splice(i + 1, 0, ipart.substr(vdigit)); } } return vdate; }, parseformat: function (vchar, vdate) { var self = this, vsettings = self.datesettings, fmt, backspace = /\\?(.?)/gi, doformat = function (t, s) { return fmt[t] ? fmt[t]() : s; }; fmt = { ///////// // day // ///////// /** * day of month with leading 0: `01..31` * @return {string} */ d: function () { return _lpad(fmt.j(), 2); }, /** * shorthand day name: `mon...sun` * @return {string} */ d: function () { return vsettings.daysshort[fmt.w()]; }, /** * day of month: `1..31` * @return {number} */ j: function () { return vdate.getdate(); }, /** * full day name: `monday...sunday` * @return {number} */ l: function () { return vsettings.days[fmt.w()]; }, /** * iso-8601 day of week: `1[mon]..7[sun]` * @return {number} */ n: function () { return fmt.w() || 7; }, /** * day of week: `0[sun]..6[sat]` * @return {number} */ w: function () { return vdate.getday(); }, /** * day of year: `0..365` * @return {number} */ z: function () { var a = new date(fmt.y(), fmt.n() - 1, fmt.j()), b = new date(fmt.y(), 0, 1); return math.round((a - b) / day); }, ////////// // week // ////////// /** * iso-8601 week number * @return {number} */ w: function () { var a = new date(fmt.y(), fmt.n() - 1, fmt.j() - fmt.n() + 3), b = new date(a.getfullyear(), 0, 4); return _lpad(1 + math.round((a - b) / day / 7), 2); }, /////////// // month // /////////// /** * full month name: `january...december` * @return {string} */ f: function () { return vsettings.months[vdate.getmonth()]; }, /** * month w/leading 0: `01..12` * @return {string} */ m: function () { return _lpad(fmt.n(), 2); }, /** * shorthand month name; `jan...dec` * @return {string} */ m: function () { return vsettings.monthsshort[vdate.getmonth()]; }, /** * month: `1...12` * @return {number} */ n: function () { return vdate.getmonth() + 1; }, /** * days in month: `28...31` * @return {number} */ t: function () { return (new date(fmt.y(), fmt.n(), 0)).getdate(); }, ////////// // year // ////////// /** * is leap year? `0 or 1` * @return {number} */ l: function () { var y = fmt.y(); return (y % 4 === 0 && y % 100 !== 0 || y % 400 === 0) ? 1 : 0; }, /** * iso-8601 year * @return {number} */ o: function () { var n = fmt.n(), w = fmt.w(), y = fmt.y(); return y + (n === 12 && w < 9 ? 1 : n === 1 && w > 9 ? -1 : 0); }, /** * full year: `e.g. 1980...2010` * @return {number} */ y: function () { return vdate.getfullyear(); }, /** * last two digits of year: `00...99` * @return {string} */ y: function () { return fmt.y().tostring().slice(-2); }, ////////// // time // ////////// /** * meridian lower: `am or pm` * @return {string} */ a: function () { return fmt.a().tolowercase(); }, /** * meridian upper: `am or pm` * @return {string} */ a: function () { var n = fmt.g() < 12 ? 0 : 1; return vsettings.meridiem[n]; }, /** * swatch internet time: `000..999` * @return {string} */ b: function () { var h = vdate.getutchours() * hour, i = vdate.getutcminutes() * 60, s = vdate.getutcseconds(); return _lpad(math.floor((h + i + s + hour) / 86.4) % 1000, 3); }, /** * 12-hours: `1..12` * @return {number} */ g: function () { return fmt.g() % 12 || 12; }, /** * 24-hours: `0..23` * @return {number} */ g: function () { return vdate.gethours(); }, /** * 12-hours with leading 0: `01..12` * @return {string} */ h: function () { return _lpad(fmt.g(), 2); }, /** * 24-hours w/leading 0: `00..23` * @return {string} */ h: function () { return _lpad(fmt.g(), 2); }, /** * minutes w/leading 0: `00..59` * @return {string} */ i: function () { return _lpad(vdate.getminutes(), 2); }, /** * seconds w/leading 0: `00..59` * @return {string} */ s: function () { return _lpad(vdate.getseconds(), 2); }, /** * microseconds: `000000-999000` * @return {string} */ u: function () { return _lpad(vdate.getmilliseconds() * 1000, 6); }, ////////////// // timezone // ////////////// /** * timezone identifier: `e.g. atlantic/azores, ...` * @return {string} */ e: function () { 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} */ i: function () { var a = new date(fmt.y(), 0), c = date.utc(fmt.y(), 0), b = new date(fmt.y(), 6), d = date.utc(fmt.y(), 6); return ((a - c) !== (b - d)) ? 1 : 0; }, /** * difference to gmt in hour format: `e.g. +0200` * @return {string} */ o: function () { var tzo = vdate.gettimezoneoffset(), a = math.abs(tzo); return (tzo > 0 ? '-' : '+') + _lpad(math.floor(a / 60) * 100 + a % 60, 4); }, /** * difference to gmt with colon: `e.g. +02:00` * @return {string} */ p: function () { var o = fmt.o(); return (o.substr(0, 3) + ':' + o.substr(3, 2)); }, /** * timezone offset in seconds: `-43200...50400` * @return {number} */ z: function () { return -vdate.gettimezoneoffset() * 60; }, //////////////////// // full date time // //////////////////// /** * iso-8601 date * @return {string} */ c: function () { return 'y-m-d\\th:i:sp'.replace(backspace, doformat); }, /** * rfc 2822 date * @return {string} */ r: function () { return 'd, d m y h:i:s o'.replace(backspace, doformat); }, /** * seconds since unix epoch * @return {number} */ u: function () { return vdate.gettime() / 1000 || 0; } }; return doformat(vchar, vchar); }, formatdate: function (vdate, vformat) { var self = this, i, n, len, str, vchar, vdatestr = ''; if (typeof vdate === 'string') { vdate = self.parsedate(vdate, vformat); if (vdate === false) { return false; } } if (vdate instanceof date) { len = vformat.length; for (i = 0; i < len; i++) { vchar = vformat.charat(i); if (vchar === 's') { continue; } str = self.parseformat(vchar, vdate); if (i !== (len - 1) && self.intparts.test(vchar) && vformat.charat(i + 1) === 's') { n = parseint(str); str += self.datesettings.ordinal(n); } vdatestr += str; } return vdatestr; } return ''; } }; })();/** * @preserve jquery datetimepicker plugin v2.5.3 * @homepage http://xdsoft.net/jqplugins/datetimepicker/ * @author chupurnov valeriy () */ /*global dateformatter, document,window,jquery,settimeout,cleartimeout,highlighteddate,getcurrentvalue*/ ;(function (factory) { if ( typeof define === 'function' && define.amd ) { // amd. register as an anonymous module. define(['jquery', 'jquery-mousewheel'], factory); } else if (typeof exports === 'object') { // node/commonjs style for browserify module.exports = factory; } else { // browser globals factory(jquery); } }(function ($) { 'use strict'; var default_options = { i18n: { ar: { // arabic months: [ "賰丕賳賵賳 丕賱孬丕賳賷", "卮亘丕胤", "丌匕丕乇", "賳賷爻丕賳", "賲丕賷賵", "丨夭賷乇丕賳", "鬲賲賵夭", "丌亘", "兀賷賱賵賱", "鬲卮乇賷賳 丕賱兀賵賱", "鬲卮乇賷賳 丕賱孬丕賳賷", "賰丕賳賵賳 丕賱兀賵賱" ], dayofweekshort: [ "賳", "孬", "毓", "禺", "噩", "爻", "丨" ], dayofweek: ["丕賱兀丨丿", "丕賱丕孬賳賷賳", "丕賱孬賱丕孬丕亍", "丕賱兀乇亘毓丕亍", "丕賱禺賲賷爻", "丕賱噩賲毓丞", "丕賱爻亘鬲", "丕賱兀丨丿"] }, ro: { // romanian months: [ "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie" ], dayofweekshort: [ "du", "lu", "ma", "mi", "jo", "vi", "s芒" ], dayofweek: ["duminic膬", "luni", "mar牛i", "miercuri", "joi", "vineri", "s芒mb膬t膬"] }, id: { // indonesian months: [ "januari", "februari", "maret", "april", "mei", "juni", "juli", "agustus", "september", "oktober", "november", "desember" ], dayofweekshort: [ "min", "sen", "sel", "rab", "kam", "jum", "sab" ], dayofweek: ["minggu", "senin", "selasa", "rabu", "kamis", "jumat", "sabtu"] }, is: { // icelandic months: [ "jan煤ar", "febr煤ar", "mars", "apr铆l", "ma铆", "j煤n铆", "j煤l铆", "脕g煤st", "september", "okt贸ber", "n贸vember", "desember" ], dayofweekshort: [ "sun", "m谩n", "脼ri冒", "mi冒", "fim", "f枚s", "lau" ], dayofweek: ["sunnudagur", "m谩nudagur", "脼ri冒judagur", "mi冒vikudagur", "fimmtudagur", "f枚studagur", "laugardagur"] }, bg: { // bulgarian months: [ "携薪褍邪褉懈", "肖械胁褉褍邪褉懈", "袦邪褉褌", "袗锌褉懈谢", "袦邪泄", "挟薪懈", "挟谢懈", "袗胁谐褍褋褌", "小械锌褌械屑胁褉懈", "袨泻褌芯屑胁褉懈", "袧芯械屑胁褉懈", "袛械泻械屑胁褉懈" ], dayofweekshort: [ "袧写", "袩薪", "袙褌", "小褉", "效褌", "袩褌", "小斜" ], dayofweek: ["袧械写械谢褟", "袩芯薪械写械谢薪懈泻", "袙褌芯褉薪懈泻", "小褉褟写邪", "效械褌胁褗褉褌褗泻", "袩械褌褗泻", "小褗斜芯褌邪"] }, fa: { // persian/farsi months: [ '賮乇賵乇丿蹖賳', '丕乇丿蹖亘賴卮鬲', '禺乇丿丕丿', '鬲蹖乇', '賲乇丿丕丿', '卮賴乇蹖賵乇', '賲賴乇', '丌亘丕賳', '丌匕乇', '丿蹖', '亘賴賲賳', '丕爻賮賳丿' ], dayofweekshort: [ '蹖讴卮賳亘賴', '丿賵卮賳亘賴', '爻賴 卮賳亘賴', '趩賴丕乇卮賳亘賴', '倬賳噩卮賳亘賴', '噩賲毓賴', '卮賳亘賴' ], dayofweek: ["蹖讴鈥屫促嗀ㄙ�", "丿賵卮賳亘賴", "爻賴鈥屫促嗀ㄙ�", "趩賴丕乇卮賳亘賴", "倬賳噩鈥屫促嗀ㄙ�", "噩賲毓賴", "卮賳亘賴", "蹖讴鈥屫促嗀ㄙ�"] }, ru: { // russian months: [ '携薪胁邪褉褜', '肖械胁褉邪谢褜', '袦邪褉褌', '袗锌褉械谢褜', '袦邪泄', '袠褞薪褜', '袠褞谢褜', '袗胁谐褍褋褌', '小械薪褌褟斜褉褜', '袨泻褌褟斜褉褜', '袧芯褟斜褉褜', '袛械泻邪斜褉褜' ], dayofweekshort: [ "袙褋", "袩薪", "袙褌", "小褉", "效褌", "袩褌", "小斜" ], dayofweek: ["袙芯褋泻褉械褋械薪褜械", "袩芯薪械写械谢褜薪懈泻", "袙褌芯褉薪懈泻", "小褉械写邪", "效械褌胁械褉谐", "袩褟褌薪懈褑邪", "小褍斜斜芯褌邪"] }, uk: { // ukrainian months: [ '小褨褔械薪褜', '袥褞褌懈泄', '袘械褉械蟹械薪褜', '袣胁褨褌械薪褜', '孝褉邪胁械薪褜', '效械褉胁械薪褜', '袥懈锌械薪褜', '小械褉锌械薪褜', '袙械褉械褋械薪褜', '袞芯胁褌械薪褜', '袥懈褋褌芯锌邪写', '袚褉褍写械薪褜' ], dayofweekshort: [ "袧写谢", "袩薪写", "袙褌褉", "小褉写", "效褌胁", "袩褌薪", "小斜褌" ], dayofweek: ["袧械写褨谢褟", "袩芯薪械写褨谢芯泻", "袙褨胁褌芯褉芯泻", "小械褉械写邪", "效械褌胁械褉", "袩'褟褌薪懈褑褟", "小褍斜芯褌邪"] }, en: { // english months: [ "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december" ], dayofweekshort: [ "sun", "mon", "tue", "wed", "thu", "fri", "sat" ], dayofweek: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] }, el: { // 螘位位畏谓喂魏维 months: [ "螜伪谓慰蠀维蟻喂慰蟼", "桅蔚尾蟻慰蠀维蟻喂慰蟼", "螠维蟻蟿喂慰蟼", "螒蟺蟻委位喂慰蟼", "螠维喂慰蟼", "螜慰蠉谓喂慰蟼", "螜慰蠉位喂慰蟼", "螒蠉纬慰蠀蟽蟿慰蟼", "危蔚蟺蟿苇渭尾蟻喂慰蟼", "螣魏蟿蠋尾蟻喂慰蟼", "螡慰苇渭尾蟻喂慰蟼", "螖蔚魏苇渭尾蟻喂慰蟼" ], dayofweekshort: [ "螝蠀蟻", "螖蔚蠀", "韦蟻喂", "韦蔚蟿", "螤蔚渭", "螤伪蟻", "危伪尾" ], dayofweek: ["螝蠀蟻喂伪魏萎", "螖蔚蠀蟿苇蟻伪", "韦蟻委蟿畏", "韦蔚蟿维蟻蟿畏", "螤苇渭蟺蟿畏", "螤伪蟻伪蟽魏蔚蠀萎", "危维尾尾伪蟿慰"] }, de: { // german months: [ 'januar', 'februar', 'm盲rz', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'dezember' ], dayofweekshort: [ "so", "mo", "di", "mi", "do", "fr", "sa" ], dayofweek: ["sonntag", "montag", "dienstag", "mittwoch", "donnerstag", "freitag", "samstag"] }, nl: { // dutch months: [ "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" ], dayofweekshort: [ "zo", "ma", "di", "wo", "do", "vr", "za" ], dayofweek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"] }, tr: { // turkish months: [ "ocak", "艦ubat", "mart", "nisan", "may谋s", "haziran", "temmuz", "a臒ustos", "eyl眉l", "ekim", "kas谋m", "aral谋k" ], dayofweekshort: [ "paz", "pts", "sal", "脟ar", "per", "cum", "cts" ], dayofweek: ["pazar", "pazartesi", "sal谋", "脟ar艧amba", "per艧embe", "cuma", "cumartesi"] }, fr: { //french months: [ "janvier", "f茅vrier", "mars", "avril", "mai", "juin", "juillet", "ao没t", "septembre", "octobre", "novembre", "d茅cembre" ], dayofweekshort: [ "dim", "lun", "mar", "mer", "jeu", "ven", "sam" ], dayofweek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"] }, es: { // spanish months: [ "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre" ], dayofweekshort: [ "dom", "lun", "mar", "mi茅", "jue", "vie", "s谩b" ], dayofweek: ["domingo", "lunes", "martes", "mi茅rcoles", "jueves", "viernes", "s谩bado"] }, th: { // thai months: [ '喔∴竵喔`覆喔勦浮', '喔佮父喔∴笭喔侧笧喔编笝喔樴箤', '喔∴傅喔權覆喔勦浮', '喙€喔∴俯喔侧涪喔�', '喔炧袱喔┼笭喔侧竸喔�', '喔∴复喔栢父喔權覆喔⑧笝', '喔佮福喔佮笌喔侧竸喔�', '喔复喔囙斧喔侧竸喔�', '喔佮副喔權涪喔侧涪喔�', '喔曕父喔ム覆喔勦浮', '喔炧袱喔ㄠ笀喔脆竵喔侧涪喔�', '喔樴副喔權抚喔侧竸喔�' ], dayofweekshort: [ '喔覆.', '喔�.', '喔�.', '喔�.', '喔炧袱.', '喔�.', '喔�.' ], dayofweek: ["喔覆喔椸复喔曕涪喙�", "喔堗副喔權笚喔`箤", "喔副喔囙竸喔侧福", "喔炧父喔�", "喔炧袱喔副喔�", "喔ㄠ父喔佮福喙�", "喙€喔覆喔`箤", "喔覆喔椸复喔曕涪喙�"] }, pl: { // polish months: [ "stycze艅", "luty", "marzec", "kwiecie艅", "maj", "czerwiec", "lipiec", "sierpie艅", "wrzesie艅", "pa藕dziernik", "listopad", "grudzie艅" ], dayofweekshort: [ "nd", "pn", "wt", "艣r", "cz", "pt", "sb" ], dayofweek: ["niedziela", "poniedzia艂ek", "wtorek", "艣roda", "czwartek", "pi膮tek", "sobota"] }, pt: { // portuguese months: [ "janeiro", "fevereiro", "mar莽o", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro" ], dayofweekshort: [ "dom", "seg", "ter", "qua", "qui", "sex", "sab" ], dayofweek: ["domingo", "segunda", "ter莽a", "quarta", "quinta", "sexta", "s谩bado"] }, ch: { // simplified chinese months: [ "涓€鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�" ], dayofweekshort: [ "鏃�", "涓€", "浜�", "涓�", "鍥�", "浜�", "鍏�" ] }, se: { // swedish months: [ "januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december" ], dayofweekshort: [ "s枚n", "m氓n", "tis", "ons", "tor", "fre", "l枚r" ] }, kr: { // korean months: [ "1鞗�", "2鞗�", "3鞗�", "4鞗�", "5鞗�", "6鞗�", "7鞗�", "8鞗�", "9鞗�", "10鞗�", "11鞗�", "12鞗�" ], dayofweekshort: [ "鞚�", "鞗�", "頇�", "靾�", "氇�", "旮�", "韱�" ], dayofweek: ["鞚检殧鞚�", "鞗旍殧鞚�", "頇旍殧鞚�", "靾橃殧鞚�", "氇╈殧鞚�", "旮堨殧鞚�", "韱犾殧鞚�"] }, it: { // italian months: [ "gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre" ], dayofweekshort: [ "dom", "lun", "mar", "mer", "gio", "ven", "sab" ], dayofweek: ["domenica", "luned矛", "marted矛", "mercoled矛", "gioved矛", "venerd矛", "sabato"] }, da: { // dansk months: [ "january", "februar", "marts", "april", "maj", "juni", "july", "august", "september", "oktober", "november", "december" ], dayofweekshort: [ "s酶n", "man", "tir", "ons", "tor", "fre", "l酶r" ], dayofweek: ["s酶ndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "l酶rdag"] }, no: { // norwegian months: [ "januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember" ], dayofweekshort: [ "s酶n", "man", "tir", "ons", "tor", "fre", "l酶r" ], dayofweek: ['s酶ndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'l酶rdag'] }, ja: { // japanese months: [ "1鏈�", "2鏈�", "3鏈�", "4鏈�", "5鏈�", "6鏈�", "7鏈�", "8鏈�", "9鏈�", "10鏈�", "11鏈�", "12鏈�" ], dayofweekshort: [ "鏃�", "鏈�", "鐏�", "姘�", "鏈�", "閲�", "鍦�" ], dayofweek: ["鏃ユ洔", "鏈堟洔", "鐏洔", "姘存洔", "鏈ㄦ洔", "閲戞洔", "鍦熸洔"] }, vi: { // vietnamese months: [ "th谩ng 1", "th谩ng 2", "th谩ng 3", "th谩ng 4", "th谩ng 5", "th谩ng 6", "th谩ng 7", "th谩ng 8", "th谩ng 9", "th谩ng 10", "th谩ng 11", "th谩ng 12" ], dayofweekshort: [ "cn", "t2", "t3", "t4", "t5", "t6", "t7" ], dayofweek: ["ch峄� nh岷璽", "th峄� hai", "th峄� ba", "th峄� t瓢", "th峄� n膬m", "th峄� s谩u", "th峄� b岷"] }, sl: { // sloven拧膷ina months: [ "januar", "februar", "marec", "april", "maj", "junij", "julij", "avgust", "september", "oktober", "november", "december" ], dayofweekshort: [ "ned", "pon", "tor", "sre", "膶et", "pet", "sob" ], dayofweek: ["nedelja", "ponedeljek", "torek", "sreda", "膶etrtek", "petek", "sobota"] }, cs: { // 膶e拧tina months: [ "leden", "脷nor", "b艡ezen", "duben", "kv臎ten", "膶erven", "膶ervenec", "srpen", "z谩艡铆", "艠铆jen", "listopad", "prosinec" ], dayofweekshort: [ "ne", "po", "脷t", "st", "膶t", "p谩", "so" ] }, hu: { // hungarian months: [ "janu谩r", "febru谩r", "m谩rcius", "脕prilis", "m谩jus", "j煤nius", "j煤lius", "augusztus", "szeptember", "okt贸ber", "november", "december" ], dayofweekshort: [ "va", "h茅", "ke", "sze", "cs", "p茅", "szo" ], dayofweek: ["vas谩rnap", "h茅tf艖", "kedd", "szerda", "cs眉t枚rt枚k", "p茅ntek", "szombat"] }, az: { //azerbaijanian (azeri) months: [ "yanvar", "fevral", "mart", "aprel", "may", "iyun", "iyul", "avqust", "sentyabr", "oktyabr", "noyabr", "dekabr" ], dayofweekshort: [ "b", "be", "脟a", "脟", "ca", "c", "艦" ], dayofweek: ["bazar", "bazar ert蓹si", "脟蓹r艧蓹nb蓹 ax艧am谋", "脟蓹r艧蓹nb蓹", "c眉m蓹 ax艧am谋", "c眉m蓹", "艦蓹nb蓹"] }, bs: { //bosanski months: [ "januar", "februar", "mart", "april", "maj", "jun", "jul", "avgust", "septembar", "oktobar", "novembar", "decembar" ], dayofweekshort: [ "ned", "pon", "uto", "sri", "膶et", "pet", "sub" ], dayofweek: ["nedjelja","ponedjeljak", "utorak", "srijeda", "膶etvrtak", "petak", "subota"] }, ca: { //catal脿 months: [ "gener", "febrer", "mar莽", "abril", "maig", "juny", "juliol", "agost", "setembre", "octubre", "novembre", "desembre" ], dayofweekshort: [ "dg", "dl", "dt", "dc", "dj", "dv", "ds" ], dayofweek: ["diumenge", "dilluns", "dimarts", "dimecres", "dijous", "divendres", "dissabte"] }, 'en-gb': { //english (british) months: [ "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december" ], dayofweekshort: [ "sun", "mon", "tue", "wed", "thu", "fri", "sat" ], dayofweek: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] }, et: { //"eesti" months: [ "jaanuar", "veebruar", "m盲rts", "aprill", "mai", "juuni", "juuli", "august", "september", "oktoober", "november", "detsember" ], dayofweekshort: [ "p", "e", "t", "k", "n", "r", "l" ], dayofweek: ["p眉hap盲ev", "esmasp盲ev", "teisip盲ev", "kolmap盲ev", "neljap盲ev", "reede", "laup盲ev"] }, eu: { //euskara months: [ "urtarrila", "otsaila", "martxoa", "apirila", "maiatza", "ekaina", "uztaila", "abuztua", "iraila", "urria", "azaroa", "abendua" ], dayofweekshort: [ "ig.", "al.", "ar.", "az.", "og.", "or.", "la." ], dayofweek: ['igandea', 'astelehena', 'asteartea', 'asteazkena', 'osteguna', 'ostirala', 'larunbata'] }, fi: { //finnish (suomi) months: [ "tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kes盲kuu", "hein盲kuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu" ], dayofweekshort: [ "su", "ma", "ti", "ke", "to", "pe", "la" ], dayofweek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"] }, gl: { //galego months: [ "xan", "feb", "maz", "abr", "mai", "xun", "xul", "ago", "set", "out", "nov", "dec" ], dayofweekshort: [ "dom", "lun", "mar", "mer", "xov", "ven", "sab" ], dayofweek: ["domingo", "luns", "martes", "m茅rcores", "xoves", "venres", "s谩bado"] }, hr: { //hrvatski months: [ "sije膷anj", "velja膷a", "o啪ujak", "travanj", "svibanj", "lipanj", "srpanj", "kolovoz", "rujan", "listopad", "studeni", "prosinac" ], dayofweekshort: [ "ned", "pon", "uto", "sri", "膶et", "pet", "sub" ], dayofweek: ["nedjelja", "ponedjeljak", "utorak", "srijeda", "膶etvrtak", "petak", "subota"] }, ko: { //korean (頃滉淡鞏�) months: [ "1鞗�", "2鞗�", "3鞗�", "4鞗�", "5鞗�", "6鞗�", "7鞗�", "8鞗�", "9鞗�", "10鞗�", "11鞗�", "12鞗�" ], dayofweekshort: [ "鞚�", "鞗�", "頇�", "靾�", "氇�", "旮�", "韱�" ], dayofweek: ["鞚检殧鞚�", "鞗旍殧鞚�", "頇旍殧鞚�", "靾橃殧鞚�", "氇╈殧鞚�", "旮堨殧鞚�", "韱犾殧鞚�"] }, lt: { //lithuanian (lietuvi懦) months: [ "sausio", "vasario", "kovo", "baland啪io", "gegu啪臈s", "bir啪elio", "liepos", "rugpj奴膷io", "rugs臈jo", "spalio", "lapkri膷io", "gruod啪io" ], dayofweekshort: [ "sek", "pir", "ant", "tre", "ket", "pen", "艩e拧" ], dayofweek: ["sekmadienis", "pirmadienis", "antradienis", "tre膷iadienis", "ketvirtadienis", "penktadienis", "艩e拧tadienis"] }, lv: { //latvian (latvie拧u) months: [ "janv膩ris", "febru膩ris", "marts", "apr墨lis ", "maijs", "j奴nijs", "j奴lijs", "augusts", "septembris", "oktobris", "novembris", "decembris" ], dayofweekshort: [ "sv", "pr", "ot", "tr", "ct", "pk", "st" ], dayofweek: ["sv膿tdiena", "pirmdiena", "otrdiena", "tre拧diena", "ceturtdiena", "piektdiena", "sestdiena"] }, mk: { //macedonian (袦邪泻械写芯薪褋泻懈) months: [ "褬邪薪褍邪褉懈", "褎械胁褉褍邪褉懈", "屑邪褉褌", "邪锌褉懈谢", "屑邪褬", "褬褍薪懈", "褬褍谢懈", "邪胁谐褍褋褌", "褋械锌褌械屑胁褉懈", "芯泻褌芯屑胁褉懈", "薪芯械屑胁褉懈", "写械泻械屑胁褉懈" ], dayofweekshort: [ "薪械写", "锌芯薪", "胁褌芯", "褋褉械", "褔械褌", "锌械褌", "褋邪斜" ], dayofweek: ["袧械写械谢邪", "袩芯薪械写械谢薪懈泻", "袙褌芯褉薪懈泻", "小褉械写邪", "效械褌胁褉褌芯泻", "袩械褌芯泻", "小邪斜芯褌邪"] }, mn: { //mongolian (袦芯薪谐芯谢) months: [ "1-褉 褋邪褉", "2-褉 褋邪褉", "3-褉 褋邪褉", "4-褉 褋邪褉", "5-褉 褋邪褉", "6-褉 褋邪褉", "7-褉 褋邪褉", "8-褉 褋邪褉", "9-褉 褋邪褉", "10-褉 褋邪褉", "11-褉 褋邪褉", "12-褉 褋邪褉" ], dayofweekshort: [ "袛邪胁", "袦褟谐", "袥褏邪", "袩爷褉", "袘褋薪", "袘褟屑", "袧褟屑" ], dayofweek: ["袛邪胁邪邪", "袦褟谐屑邪褉", "袥褏邪谐胁邪", "袩爷褉褝胁", "袘邪邪褋邪薪", "袘褟屑斜邪", "袧褟屑"] }, 'pt-br': { //portugu锚s(brasil) months: [ "janeiro", "fevereiro", "mar莽o", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro" ], dayofweekshort: [ "dom", "seg", "ter", "qua", "qui", "sex", "s谩b" ], dayofweek: ["domingo", "segunda", "ter莽a", "quarta", "quinta", "sexta", "s谩bado"] }, sk: { //sloven膷ina months: [ "janu谩r", "febru谩r", "marec", "apr铆l", "m谩j", "j煤n", "j煤l", "august", "september", "okt贸ber", "november", "december" ], dayofweekshort: [ "ne", "po", "ut", "st", "艩t", "pi", "so" ], dayofweek: ["nede木a", "pondelok", "utorok", "streda", "艩tvrtok", "piatok", "sobota"] }, sq: { //albanian (shqip) months: [ "janar", "shkurt", "mars", "prill", "maj", "qershor", "korrik", "gusht", "shtator", "tetor", "n毛ntor", "dhjetor" ], dayofweekshort: [ "die", "h毛n", "mar", "m毛r", "enj", "pre", "shtu" ], dayofweek: ["e diel", "e h毛n毛", "e mart膿", "e m毛rkur毛", "e enjte", "e premte", "e shtun毛"] }, 'sr-yu': { //serbian (srpski) months: [ "januar", "februar", "mart", "april", "maj", "jun", "jul", "avgust", "septembar", "oktobar", "novembar", "decembar" ], dayofweekshort: [ "ned", "pon", "uto", "sre", "膷et", "pet", "sub" ], dayofweek: ["nedelja","ponedeljak", "utorak", "sreda", "膶etvrtak", "petak", "subota"] }, sr: { //serbian cyrillic (小褉锌褋泻懈) months: [ "褬邪薪褍邪褉", "褎械斜褉褍邪褉", "屑邪褉褌", "邪锌褉懈谢", "屑邪褬", "褬褍薪", "褬褍谢", "邪胁谐褍褋褌", "褋械锌褌械屑斜邪褉", "芯泻褌芯斜邪褉", "薪芯胁械屑斜邪褉", "写械褑械屑斜邪褉" ], dayofweekshort: [ "薪械写", "锌芯薪", "褍褌芯", "褋褉械", "褔械褌", "锌械褌", "褋褍斜" ], dayofweek: ["袧械写械褭邪","袩芯薪械写械褭邪泻", "校褌芯褉邪泻", "小褉械写邪", "效械褌胁褉褌邪泻", "袩械褌邪泻", "小褍斜芯褌邪"] }, sv: { //svenska months: [ "januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december" ], dayofweekshort: [ "s枚n", "m氓n", "tis", "ons", "tor", "fre", "l枚r" ], dayofweek: ["s枚ndag", "m氓ndag", "tisdag", "onsdag", "torsdag", "fredag", "l枚rdag"] }, 'zh-tw': { //traditional chinese (绻侀珨涓枃) months: [ "涓€鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�" ], dayofweekshort: [ "鏃�", "涓€", "浜�", "涓�", "鍥�", "浜�", "鍏�" ], dayofweek: ["鏄熸湡鏃�", "鏄熸湡涓€", "鏄熸湡浜�", "鏄熸湡涓�", "鏄熸湡鍥�", "鏄熸湡浜�", "鏄熸湡鍏�"] }, zh: { //simplified chinese (绠€浣撲腑鏂�) months: [ "涓€鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�" ], dayofweekshort: [ "鏃�", "涓€", "浜�", "涓�", "鍥�", "浜�", "鍏�" ], dayofweek: ["鏄熸湡鏃�", "鏄熸湡涓€", "鏄熸湡浜�", "鏄熸湡涓�", "鏄熸湡鍥�", "鏄熸湡浜�", "鏄熸湡鍏�"] }, he: { //hebrew (注讘专讬转) months: [ '讬谞讜讗专', '驻讘专讜讗专', '诪专抓', '讗驻专讬诇', '诪讗讬', '讬讜谞讬', '讬讜诇讬', '讗讜讙讜住讟', '住驻讟诪讘专', '讗讜拽讟讜讘专', '谞讜讘诪讘专', '讚爪诪讘专' ], dayofweekshort: [ '讗\'', '讘\'', '讙\'', '讚\'', '讛\'', '讜\'', '砖讘转' ], dayofweek: ["专讗砖讜谉", "砖谞讬", "砖诇讬砖讬", "专讘讬注讬", "讞诪讬砖讬", "砖讬砖讬", "砖讘转", "专讗砖讜谉"] }, hy: { // armenian months: [ "諃崭謧斩站铡謤", "論榨湛謤站铡謤", "談铡謤湛", "员蘸謤斋宅", "談铡盏斋战", "諃崭謧斩斋战", "諃崭謧宅斋战", "諘眨崭战湛崭战", "諐榨蘸湛榨沾闸榨謤", "諃崭寨湛榨沾闸榨謤", "諉崭盏榨沾闸榨謤", "源榨寨湛榨沾闸榨謤" ], dayofweekshort: [ "钥斋", "缘謤寨", "缘謤謩", "諌崭謤", "諃斩眨", "請謧謤闸", "諊闸诈" ], dayofweek: ["钥斋謤铡寨斋", "缘謤寨崭謧辗铡闸诈斋", "缘謤榨謩辗铡闸诈斋", "諌崭謤榨謩辗铡闸诈斋", "諃斋斩眨辗铡闸诈斋", "請謧謤闸铡诈", "諊铡闸铡诈"] }, kg: { // kyrgyz months: [ '耶褔褌爷薪 邪泄褘', '袘懈褉写懈薪 邪泄褘', '袞邪谢谐邪薪 袣褍褉邪薪', '效褘薪 袣褍褉邪薪', '袘褍谐褍', '袣褍谢卸邪', '孝械泻械', '袘邪褕 袨芯薪邪', '袗褟泻 袨芯薪邪', '孝芯谐褍蟹写褍薪 邪泄褘', '袞械褌懈薪懈薪 邪泄褘', '袘械褕褌懈薪 邪泄褘' ], dayofweekshort: [ "袞械泻", "袛爷泄", "楔械泄", "楔邪褉", "袘械泄", "袞褍屑", "袠褕械" ], dayofweek: [ "袞械泻褕械屑斜", "袛爷泄褕萤屑斜", "楔械泄褕械屑斜", "楔邪褉褕械屑斜", "袘械泄褕械屑斜懈", "袞褍屑邪", "袠褕械薪斜" ] }, rm: { // romansh months: [ "schaner", "favrer", "mars", "avrigl", "matg", "zercladur", "fanadur", "avust", "settember", "october", "november", "december" ], dayofweekshort: [ "du", "gli", "ma", "me", "gie", "ve", "so" ], dayofweek: [ "dumengia", "glindesdi", "mardi", "mesemna", "gievgia", "venderdi", "sonda" ] }, ka: { // georgian months: [ '醿樶儛醿溼儠醿愥儬醿�', '醿椺償醿戓償醿犪儠醿愥儦醿�', '醿涐儛醿犪儮醿�', '醿愥優醿犪儤醿氠儤', '醿涐儛醿樶儭醿�', '醿樶儠醿溼儤醿♂儤', '醿樶儠醿氠儤醿♂儤', '醿愥儝醿曖儤醿♂儮醿�', '醿♂償醿メ儮醿斸儧醿戓償醿犪儤', '醿濁儱醿⑨儩醿涐儜醿斸儬醿�', '醿溼儩醿斸儧醿戓償醿犪儤', '醿撫償醿欋償醿涐儜醿斸儬醿�' ], dayofweekshort: [ "醿欋儠", "醿濁儬醿�", "醿♂儛醿涐儴", "醿濁儣醿�", "醿儯醿�", "醿炨儛醿�", "醿ㄡ儛醿�" ], dayofweek: ["醿欋儠醿樶儬醿�", "醿濁儬醿ㄡ儛醿戓儛醿椺儤", "醿♂儛醿涐儴醿愥儜醿愥儣醿�", "醿濁儣醿儴醿愥儜醿愥儣醿�", "醿儯醿椺儴醿愥儜醿愥儣醿�", "醿炨儛醿犪儛醿♂儥醿斸儠醿�", "醿ㄡ儛醿戓儛醿椺儤"] }, }, value: '', rtl: false, format: 'y/m/d h:i', formattime: 'h:i', formatdate: 'y/m/d', startdate: false, // new date(), '1986/12/08', '-1970/01/05','-1970/01/05', step: 60, monthchangespinner: true, closeondateselect: false, closeontimeselect: true, closeonwithoutclick: true, closeoninputclick: true, timepicker: true, datepicker: true, weeks: false, defaulttime: false, // use formattime format (ex. '10:00' for formattime: 'h:i') defaultdate: false, // use formatdate format (ex new date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05') mindate: false, maxdate: false, mintime: false, maxtime: false, disabledmintime: false, disabledmaxtime: false, allowtimes: [], opened: false, inittime: true, inline: false, theme: '', onselectdate: function () {}, onselecttime: function () {}, onchangemonth: function () {}, ongetweekofyear: function () {}, onchangeyear: function () {}, onchangedatetime: function () {}, onshow: function () {}, onclose: function () {}, ongenerate: function () {}, withoutcopyright: true, inversebutton: false, hours12: false, next: 'xdsoft_next', prev : 'xdsoft_prev', dayofweekstart: 0, parentid: 'body', timeheightintimepicker: 25, timepickerscrollbar: true, todaybutton: true, prevbutton: true, nextbutton: true, defaultselect: true, scrollmonth: true, scrolltime: true, scrollinput: true, lazyinit: false, mask: false, validateonblur: true, allowblank: true, yearstart: 1950, yearend: 2050, monthstart: 0, monthend: 11, style: '', id: '', fixed: false, roundtime: 'round', // ceil, floor classname: '', weekends: [], highlighteddates: [], highlightedperiods: [], allowdates : [], allowdatere : null, disableddates : [], disabledweekdays: [], yearoffset: 0, beforeshowday: null, enterliketab: true, showapplybutton: false }; var datehelper = null, globallocaledefault = 'en', globallocale = 'en'; var dateformatteroptionsdefault = { meridiem: ['am', 'pm'] }; var initdateformatter = function(){ var locale = default_options.i18n[globallocale], opts = { days: locale.dayofweek, daysshort: locale.dayofweekshort, months: locale.months, monthsshort: $.map(locale.months, function(n){ return n.substring(0, 3) }), }; datehelper = new dateformatter({ datesettings: $.extend({}, dateformatteroptionsdefault, opts) }); }; // for locale settings $.datetimepicker = { setlocale: function(locale){ var newlocale = default_options.i18n[locale]?locale:globallocaledefault; if(globallocale != newlocale){ globallocale = newlocale; // reinit date formatter initdateformatter(); } }, setdateformatter: function(dateformatter) { datehelper = dateformatter; }, rfc_2822: 'd, d m y h:i:s o', atom: 'y-m-d\th:i:sp', iso_8601: 'y-m-d\th:i:so', rfc_822: 'd, d m y h:i:s o', rfc_850: 'l, d-m-y h:i:s t', rfc_1036: 'd, d m y h:i:s o', rfc_1123: 'd, d m y h:i:s o', rss: 'd, d m y h:i:s o', w3c: 'y-m-d\th:i:sp' }; // first init date formatter initdateformatter(); // fix for ie8 if (!window.getcomputedstyle) { window.getcomputedstyle = function (el, pseudo) { this.el = el; this.getpropertyvalue = function (prop) { var re = /(\-([a-z]){1})/g; if (prop === 'float') { prop = 'stylefloat'; } if (re.test(prop)) { prop = prop.replace(re, function (a, b, c) { return c.touppercase(); }); } return el.currentstyle[prop] || null; }; return this; }; } if (!array.prototype.indexof) { array.prototype.indexof = function (obj, start) { var i, j; for (i = (start || 0), j = this.length; i < j; i += 1) { if (this[i] === obj) { return i; } } return -1; }; } date.prototype.countdaysinmonth = function () { return new date(this.getfullyear(), this.getmonth() + 1, 0).getdate(); }; $.fn.xdsoftscroller = function (percent) { return this.each(function () { var timeboxparent = $(this), pointereventtoxy = function (e) { var out = {x: 0, y: 0}, touch; if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { touch = e.originalevent.touches[0] || e.originalevent.changedtouches[0]; out.x = touch.clientx; out.y = touch.clienty; } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') { out.x = e.clientx; out.y = e.clienty; } return out; }, timebox, parentheight, height, scrollbar, scroller, maximumoffset = 100, start = false, starty = 0, starttop = 0, h1 = 0, touchstart = false, starttopscroll = 0, calcoffset = function () {}; if (percent === 'hide') { timeboxparent.find('.xdsoft_scrollbar').hide(); return; } if (!$(this).hasclass('xdsoft_scroller_box')) { timebox = timeboxparent.children().eq(0); parentheight = timeboxparent[0].clientheight; height = timebox[0].offsetheight; scrollbar = $('
'); scroller = $('
'); scrollbar.append(scroller); timeboxparent.addclass('xdsoft_scroller_box').append(scrollbar); calcoffset = function calcoffset(event) { var offset = pointereventtoxy(event).y - starty + starttopscroll; if (offset < 0) { offset = 0; } if (offset + scroller[0].offsetheight > h1) { offset = h1 - scroller[0].offsetheight; } timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumoffset ? offset / maximumoffset : 0]); }; scroller .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) { if (!parentheight) { timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); } starty = pointereventtoxy(event).y; starttopscroll = parseint(scroller.css('margin-top'), 10); h1 = scrollbar[0].offsetheight; if (event.type === 'mousedown' || event.type === 'touchstart') { if (document) { $(document.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) .off('mousemove.xdsoft_scroller', calcoffset) .removeclass('xdsoft_noselect'); }); $(document.body).on('mousemove.xdsoft_scroller', calcoffset); } else { touchstart = true; event.stoppropagation(); event.preventdefault(); } }) .on('touchmove', function (event) { if (touchstart) { event.preventdefault(); calcoffset(event); } }) .on('touchend touchcancel', function () { touchstart = false; starttopscroll = 0; }); timeboxparent .on('scroll_element.xdsoft_scroller', function (event, percentage) { if (!parentheight) { timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]); } percentage = percentage > 1 ? 1 : (percentage < 0 || isnan(percentage)) ? 0 : percentage; scroller.css('margin-top', maximumoffset * percentage); settimeout(function () { timebox.css('margintop', -parseint((timebox[0].offsetheight - parentheight) * percentage, 10)); }, 10); }) .on('resize_scroll.xdsoft_scroller', function (event, percentage, notriggerscroll) { var percent, sh; parentheight = timeboxparent[0].clientheight; height = timebox[0].offsetheight; percent = parentheight / height; sh = percent * scrollbar[0].offsetheight; if (percent > 1) { scroller.hide(); } else { scroller.show(); scroller.css('height', parseint(sh > 10 ? sh : 10, 10)); maximumoffset = scrollbar[0].offsetheight - scroller[0].offsetheight; if (notriggerscroll !== true) { timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || math.abs(parseint(timebox.css('margintop'), 10)) / (height - parentheight)]); } } }); timeboxparent.on('mousewheel', function (event) { var top = math.abs(parseint(timebox.css('margintop'), 10)); top = top - (event.deltay * 20); if (top < 0) { top = 0; } timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentheight)]); event.stoppropagation(); return false; }); timeboxparent.on('touchstart', function (event) { start = pointereventtoxy(event); starttop = math.abs(parseint(timebox.css('margintop'), 10)); }); timeboxparent.on('touchmove', function (event) { if (start) { event.preventdefault(); var coord = pointereventtoxy(event); timeboxparent.trigger('scroll_element.xdsoft_scroller', [(starttop - (coord.y - start.y)) / (height - parentheight)]); } }); timeboxparent.on('touchend touchcancel', function () { start = false; starttop = 0; }); } timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); }); }; $.fn.datetimepicker = function (opt, opt2) { var result = this, key0 = 48, key9 = 57, _key0 = 96, _key9 = 105, ctrlkey = 17, del = 46, enter = 13, esc = 27, backspace = 8, arrowleft = 37, arrowup = 38, arrowright = 39, arrowdown = 40, tab = 9, f5 = 116, akey = 65, ckey = 67, vkey = 86, zkey = 90, ykey = 89, ctrldown = false, options = ($.isplainobject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options), lazyinittimer = 0, createdatetimepicker, destroydatetimepicker, lazyinit = function (input) { input .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initonactioncallback() { if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { return; } cleartimeout(lazyinittimer); lazyinittimer = settimeout(function () { if (!input.data('xdsoft_datetimepicker')) { createdatetimepicker(input); } input .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initonactioncallback) .trigger('open.xdsoft'); }, 100); }); }; createdatetimepicker = function (input) { var datetimepicker = $('
'), xdsoft_copyright = $(''), datepicker = $('
'), mounth_picker = $('
' + '
' + '
' + '
'), calendar = $('
'), timepicker = $('
'), timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), timebox = $('
'), applybutton = $(''), monthselect = $('
'), yearselect = $('
'), triggerafteropen = false, xdsoft_datetime, xchangetimer, timerclick, current_time_index, setpos, timer = 0, _xdsoft_datetime, foreachancestorof; if (options.id) { datetimepicker.attr('id', options.id); } if (options.style) { datetimepicker.attr('style', options.style); } if (options.weeks) { datetimepicker.addclass('xdsoft_showweeks'); } if (options.rtl) { datetimepicker.addclass('xdsoft_rtl'); } datetimepicker.addclass('xdsoft_' + options.theme); datetimepicker.addclass(options.classname); mounth_picker .find('.xdsoft_month span') .after(monthselect); mounth_picker .find('.xdsoft_year span') .after(yearselect); mounth_picker .find('.xdsoft_month,.xdsoft_year') .on('touchstart mousedown.xdsoft', function (event) { var select = $(this).find('.xdsoft_select').eq(0), val = 0, top = 0, visible = select.is(':visible'), items, i; mounth_picker .find('.xdsoft_select') .hide(); if (_xdsoft_datetime.currenttime) { val = _xdsoft_datetime.currenttime[$(this).hasclass('xdsoft_month') ? 'getmonth' : 'getfullyear'](); } select[visible ? 'hide' : 'show'](); for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) { if (items.eq(i).data('value') === val) { break; } else { top += items[0].offsetheight; } } select.xdsoftscroller(top / (select.children()[0].offsetheight - (select[0].clientheight))); event.stoppropagation(); return false; }); mounth_picker .find('.xdsoft_select') .xdsoftscroller() .on('touchstart mousedown.xdsoft', function (event) { event.stoppropagation(); event.preventdefault(); }) .on('touchstart mousedown.xdsoft', '.xdsoft_option', function () { if (_xdsoft_datetime.currenttime === undefined || _xdsoft_datetime.currenttime === null) { _xdsoft_datetime.currenttime = _xdsoft_datetime.now(); } var year = _xdsoft_datetime.currenttime.getfullyear(); if (_xdsoft_datetime && _xdsoft_datetime.currenttime) { _xdsoft_datetime.currenttime[$(this).parent().parent().hasclass('xdsoft_monthselect') ? 'setmonth' : 'setfullyear']($(this).data('value')); } $(this).parent().parent().hide(); datetimepicker.trigger('xchange.xdsoft'); if (options.onchangemonth && $.isfunction(options.onchangemonth)) { options.onchangemonth.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input')); } if (year !== _xdsoft_datetime.currenttime.getfullyear() && $.isfunction(options.onchangeyear)) { options.onchangeyear.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input')); } }); datetimepicker.getvalue = function () { return _xdsoft_datetime.getcurrenttime(); }; datetimepicker.setoptions = function (_options) { var highlighteddates = {}; options = $.extend(true, {}, options, _options); if (_options.allowtimes && $.isarray(_options.allowtimes) && _options.allowtimes.length) { options.allowtimes = $.extend(true, [], _options.allowtimes); } if (_options.weekends && $.isarray(_options.weekends) && _options.weekends.length) { options.weekends = $.extend(true, [], _options.weekends); } if (_options.allowdates && $.isarray(_options.allowdates) && _options.allowdates.length) { options.allowdates = $.extend(true, [], _options.allowdates); } if (_options.allowdatere && object.prototype.tostring.call(_options.allowdatere)==="[object string]") { options.allowdatere = new regexp(_options.allowdatere); } if (_options.highlighteddates && $.isarray(_options.highlighteddates) && _options.highlighteddates.length) { $.each(_options.highlighteddates, function (index, value) { var splitdata = $.map(value.split(','), $.trim), exdesc, hdate = new highlighteddate(datehelper.parsedate(splitdata[0], options.formatdate), splitdata[1], splitdata[2]), // date, desc, style keydate = datehelper.formatdate(hdate.date, options.formatdate); if (highlighteddates[keydate] !== undefined) { exdesc = highlighteddates[keydate].desc; if (exdesc && exdesc.length && hdate.desc && hdate.desc.length) { highlighteddates[keydate].desc = exdesc + "\n" + hdate.desc; } } else { highlighteddates[keydate] = hdate; } }); options.highlighteddates = $.extend(true, [], highlighteddates); } if (_options.highlightedperiods && $.isarray(_options.highlightedperiods) && _options.highlightedperiods.length) { highlighteddates = $.extend(true, [], options.highlighteddates); $.each(_options.highlightedperiods, function (index, value) { var datetest, // start date dateend, desc, hdate, keydate, exdesc, style; if ($.isarray(value)) { datetest = value[0]; dateend = value[1]; desc = value[2]; style = value[3]; } else { var splitdata = $.map(value.split(','), $.trim); datetest = datehelper.parsedate(splitdata[0], options.formatdate); dateend = datehelper.parsedate(splitdata[1], options.formatdate); desc = splitdata[2]; style = splitdata[3]; } while (datetest <= dateend) { hdate = new highlighteddate(datetest, desc, style); keydate = datehelper.formatdate(datetest, options.formatdate); datetest.setdate(datetest.getdate() + 1); if (highlighteddates[keydate] !== undefined) { exdesc = highlighteddates[keydate].desc; if (exdesc && exdesc.length && hdate.desc && hdate.desc.length) { highlighteddates[keydate].desc = exdesc + "\n" + hdate.desc; } } else { highlighteddates[keydate] = hdate; } } }); options.highlighteddates = $.extend(true, [], highlighteddates); } if (_options.disableddates && $.isarray(_options.disableddates) && _options.disableddates.length) { options.disableddates = $.extend(true, [], _options.disableddates); } if (_options.disabledweekdays && $.isarray(_options.disabledweekdays) && _options.disabledweekdays.length) { options.disabledweekdays = $.extend(true, [], _options.disabledweekdays); } if ((options.open || options.opened) && (!options.inline)) { input.trigger('open.xdsoft'); } if (options.inline) { triggerafteropen = true; datetimepicker.addclass('xdsoft_inline'); input.after(datetimepicker).hide(); } if (options.inversebutton) { options.next = 'xdsoft_prev'; options.prev = 'xdsoft_next'; } if (options.datepicker) { datepicker.addclass('active'); } else { datepicker.removeclass('active'); } if (options.timepicker) { timepicker.addclass('active'); } else { timepicker.removeclass('active'); } if (options.value) { _xdsoft_datetime.setcurrenttime(options.value); if (input && input.val) { input.val(_xdsoft_datetime.str); } } if (isnan(options.dayofweekstart)) { options.dayofweekstart = 0; } else { options.dayofweekstart = parseint(options.dayofweekstart, 10) % 7; } if (!options.timepickerscrollbar) { timeboxparent.xdsoftscroller('hide'); } if (options.mindate && /^[\+\-](.*)$/.test(options.mindate)) { options.mindate = datehelper.formatdate(_xdsoft_datetime.strtodatetime(options.mindate), options.formatdate); } if (options.maxdate && /^[\+\-](.*)$/.test(options.maxdate)) { options.maxdate = datehelper.formatdate(_xdsoft_datetime.strtodatetime(options.maxdate), options.formatdate); } applybutton.toggle(options.showapplybutton); mounth_picker .find('.xdsoft_today_button') .css('visibility', !options.todaybutton ? 'hidden' : 'visible'); mounth_picker .find('.' + options.prev) .css('visibility', !options.prevbutton ? 'hidden' : 'visible'); mounth_picker .find('.' + options.next) .css('visibility', !options.nextbutton ? 'hidden' : 'visible'); setmask(options); if (options.validateonblur) { input .off('blur.xdsoft') .on('blur.xdsoft', function () { if (options.allowblank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) { $(this).val(null); datetimepicker.data('xdsoft_datetime').empty(); } else { var d = datehelper.parsedate($(this).val(), options.format); if (d) { // parsedate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time $(this).val(datehelper.formatdate(d, options.format)); } else { var splittedhours = +([$(this).val()[0], $(this).val()[1]].join('')), splittedminutes = +([$(this).val()[2], $(this).val()[3]].join('')); // parse the numbers as 0312 => 03:12 if (!options.datepicker && options.timepicker && splittedhours >= 0 && splittedhours < 24 && splittedminutes >= 0 && splittedminutes < 60) { $(this).val([splittedhours, splittedminutes].map(function (item) { return item > 9 ? item : '0' + item; }).join(':')); } else { $(this).val(datehelper.formatdate(_xdsoft_datetime.now(), options.format)); } } datetimepicker.data('xdsoft_datetime').setcurrenttime($(this).val()); } datetimepicker.trigger('changedatetime.xdsoft'); datetimepicker.trigger('close.xdsoft'); }); } options.dayofweekstartprev = (options.dayofweekstart === 0) ? 6 : options.dayofweekstart - 1; datetimepicker .trigger('xchange.xdsoft') .trigger('afteropen.xdsoft'); }; datetimepicker .data('options', options) .on('touchstart mousedown.xdsoft', function (event) { event.stoppropagation(); event.preventdefault(); yearselect.hide(); monthselect.hide(); return false; }); //scroll_element = timepicker.find('.xdsoft_time_box'); timeboxparent.append(timebox); timeboxparent.xdsoftscroller(); datetimepicker.on('afteropen.xdsoft', function () { timeboxparent.xdsoftscroller(); }); datetimepicker .append(datepicker) .append(timepicker); if (options.withoutcopyright !== true) { datetimepicker .append(xdsoft_copyright); } datepicker .append(mounth_picker) .append(calendar) .append(applybutton); $(options.parentid) .append(datetimepicker); xdsoft_datetime = function () { var _this = this; _this.now = function (norecursion) { var d = new date(), date, time; if (!norecursion && options.defaultdate) { date = _this.strtodatetime(options.defaultdate); d.setfullyear(date.getfullyear()); d.setmonth(date.getmonth()); d.setdate(date.getdate()); } if (options.yearoffset) { d.setfullyear(d.getfullyear() + options.yearoffset); } if (!norecursion && options.defaulttime) { time = _this.strtotime(options.defaulttime); d.sethours(time.gethours()); d.setminutes(time.getminutes()); } return d; }; _this.isvaliddate = function (d) { if (object.prototype.tostring.call(d) !== "[object date]") { return false; } return !isnan(d.gettime()); }; _this.setcurrenttime = function (dtime) { _this.currenttime = (typeof dtime === 'string') ? _this.strtodatetime(dtime) : _this.isvaliddate(dtime) ? dtime : _this.now(); datetimepicker.trigger('xchange.xdsoft'); }; _this.empty = function () { _this.currenttime = null; }; _this.getcurrenttime = function (dtime) { return _this.currenttime; }; _this.nextmonth = function () { if (_this.currenttime === undefined || _this.currenttime === null) { _this.currenttime = _this.now(); } var month = _this.currenttime.getmonth() + 1, year; if (month === 12) { _this.currenttime.setfullyear(_this.currenttime.getfullyear() + 1); month = 0; } year = _this.currenttime.getfullyear(); _this.currenttime.setdate( math.min( new date(_this.currenttime.getfullyear(), month + 1, 0).getdate(), _this.currenttime.getdate() ) ); _this.currenttime.setmonth(month); if (options.onchangemonth && $.isfunction(options.onchangemonth)) { options.onchangemonth.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input')); } if (year !== _this.currenttime.getfullyear() && $.isfunction(options.onchangeyear)) { options.onchangeyear.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input')); } datetimepicker.trigger('xchange.xdsoft'); return month; }; _this.prevmonth = function () { if (_this.currenttime === undefined || _this.currenttime === null) { _this.currenttime = _this.now(); } var month = _this.currenttime.getmonth() - 1; if (month === -1) { _this.currenttime.setfullyear(_this.currenttime.getfullyear() - 1); month = 11; } _this.currenttime.setdate( math.min( new date(_this.currenttime.getfullyear(), month + 1, 0).getdate(), _this.currenttime.getdate() ) ); _this.currenttime.setmonth(month); if (options.onchangemonth && $.isfunction(options.onchangemonth)) { options.onchangemonth.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input')); } datetimepicker.trigger('xchange.xdsoft'); return month; }; _this.getweekofyear = function (datetime) { if (options.ongetweekofyear && $.isfunction(options.ongetweekofyear)) { var week = options.ongetweekofyear.call(datetimepicker, datetime); if (typeof week !== 'undefined') { return week; } } var onejan = new date(datetime.getfullyear(), 0, 1); //first week of the year is th one with the first thursday according to iso8601 if(onejan.getday()!=4) onejan.setmonth(0, 1 + ((4 - onejan.getday()+ 7) % 7)); return math.ceil((((datetime - onejan) / 86400000) + onejan.getday() + 1) / 7); }; _this.strtodatetime = function (sdatetime) { var tmpdate = [], timeoffset, currenttime; if (sdatetime && sdatetime instanceof date && _this.isvaliddate(sdatetime)) { return sdatetime; } tmpdate = /^(\+|\-)(.*)$/.exec(sdatetime); if (tmpdate) { tmpdate[2] = datehelper.parsedate(tmpdate[2], options.formatdate); } if (tmpdate && tmpdate[2]) { timeoffset = tmpdate[2].gettime() - (tmpdate[2].gettimezoneoffset()) * 60000; currenttime = new date((_this.now(true)).gettime() + parseint(tmpdate[1] + '1', 10) * timeoffset); } else { currenttime = sdatetime ? datehelper.parsedate(sdatetime, options.format) : _this.now(); } if (!_this.isvaliddate(currenttime)) { currenttime = _this.now(); } return currenttime; }; _this.strtodate = function (sdate) { if (sdate && sdate instanceof date && _this.isvaliddate(sdate)) { return sdate; } var currenttime = sdate ? datehelper.parsedate(sdate, options.formatdate) : _this.now(true); if (!_this.isvaliddate(currenttime)) { currenttime = _this.now(true); } return currenttime; }; _this.strtotime = function (stime) { if (stime && stime instanceof date && _this.isvaliddate(stime)) { return stime; } var currenttime = stime ? datehelper.parsedate(stime, options.formattime) : _this.now(true); if (!_this.isvaliddate(currenttime)) { currenttime = _this.now(true); } return currenttime; }; _this.str = function () { return datehelper.formatdate(_this.currenttime, options.format); }; _this.currenttime = this.now(); }; _xdsoft_datetime = new xdsoft_datetime(); applybutton.on('touchend click', function (e) {//pathbrite e.preventdefault(); datetimepicker.data('changed', true); _xdsoft_datetime.setcurrenttime(getcurrentvalue()); input.val(_xdsoft_datetime.str()); datetimepicker.trigger('close.xdsoft'); }); mounth_picker .find('.xdsoft_today_button') .on('touchend mousedown.xdsoft', function () { datetimepicker.data('changed', true); _xdsoft_datetime.setcurrenttime(0); datetimepicker.trigger('afteropen.xdsoft'); }).on('dblclick.xdsoft', function () { var currentdate = _xdsoft_datetime.getcurrenttime(), mindate, maxdate; currentdate = new date(currentdate.getfullyear(), currentdate.getmonth(), currentdate.getdate()); mindate = _xdsoft_datetime.strtodate(options.mindate); mindate = new date(mindate.getfullyear(), mindate.getmonth(), mindate.getdate()); if (currentdate < mindate) { return; } maxdate = _xdsoft_datetime.strtodate(options.maxdate); maxdate = new date(maxdate.getfullyear(), maxdate.getmonth(), maxdate.getdate()); if (currentdate > maxdate) { return; } input.val(_xdsoft_datetime.str()); input.trigger('change'); datetimepicker.trigger('close.xdsoft'); }); mounth_picker .find('.xdsoft_prev,.xdsoft_next') .on('touchend mousedown.xdsoft', function () { var $this = $(this), timer = 0, stop = false; (function arguments_callee1(v) { if ($this.hasclass(options.next)) { _xdsoft_datetime.nextmonth(); } else if ($this.hasclass(options.prev)) { _xdsoft_datetime.prevmonth(); } if (options.monthchangespinner) { if (!stop) { timer = settimeout(arguments_callee1, v || 100); } } }(500)); $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() { cleartimeout(timer); stop = true; $([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2); }); }); timepicker .find('.xdsoft_prev,.xdsoft_next') .on('touchend mousedown.xdsoft', function () { var $this = $(this), timer = 0, stop = false, period = 110; (function arguments_callee4(v) { 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) { timebox.css('margintop', '-' + (top + options.timeheightintimepicker) + 'px'); } else if ($this.hasclass(options.prev) && top - options.timeheightintimepicker >= 0) { timebox.css('margintop', '-' + (top - options.timeheightintimepicker) + 'px'); } /** * fixed bug: * when using css3 transition, it will cause a bug that you cannot scroll the timepicker list. * the reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this * would cause a bug when you use jquery.css method. * let's say: * { transition: all .5s ease; } * jquery timebox.css('margintop') will return the original value which is before you clicking the next/prev button, * meanwhile the timebox[0].style.margintop will return the right value which is after you clicking the * next/prev button. * * what we should do: * replace timebox.css('margintop') with timebox[0].style.margintop. */ timeboxparent.trigger('scroll_element.xdsoft_scroller', [math.abs(parseint(timebox[0].style.margintop, 10) / (height - pheight))]); period = (period > 10) ? 10 : period - 10; if (!stop) { timer = settimeout(arguments_callee4, v || period); } }(500)); $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() { cleartimeout(timer); stop = true; $([document.body, window]) .off('touchend mouseup.xdsoft', arguments_callee5); }); }); xchangetimer = 0; // base handler - generating a calendar and timepicker datetimepicker .on('xchange.xdsoft', function (event) { cleartimeout(xchangetimer); xchangetimer = settimeout(function () { if (_xdsoft_datetime.currenttime === undefined || _xdsoft_datetime.currenttime === null) { _xdsoft_datetime.currenttime = _xdsoft_datetime.now(); } var table = '', start = new date(_xdsoft_datetime.currenttime.getfullyear(), _xdsoft_datetime.currenttime.getmonth(), 1, 12, 0, 0), i = 0, j, today = _xdsoft_datetime.now(), maxdate = false, mindate = false, hdate, day, d, y, m, w, classes = [], customdatesettings, newrow = true, time = '', h = '', line_time, description; while (start.getday() !== options.dayofweekstart) { start.setdate(start.getdate() - 1); } table += ''; if (options.weeks) { table += ''; } for (j = 0; j < 7; j += 1) { table += ''; } table += ''; table += ''; if (options.maxdate !== false) { maxdate = _xdsoft_datetime.strtodate(options.maxdate); maxdate = new date(maxdate.getfullyear(), maxdate.getmonth(), maxdate.getdate(), 23, 59, 59, 999); } if (options.mindate !== false) { mindate = _xdsoft_datetime.strtodate(options.mindate); mindate = new date(mindate.getfullyear(), mindate.getmonth(), mindate.getdate()); } while (i < _xdsoft_datetime.currenttime.countdaysinmonth() || start.getday() !== options.dayofweekstart || _xdsoft_datetime.currenttime.getmonth() === start.getmonth()) { classes = []; i += 1; day = start.getday(); d = start.getdate(); y = start.getfullyear(); m = start.getmonth(); w = _xdsoft_datetime.getweekofyear(start); description = ''; classes.push('xdsoft_date'); if (options.beforeshowday && $.isfunction(options.beforeshowday.call)) { customdatesettings = options.beforeshowday.call(datetimepicker, start); } else { customdatesettings = null; } if(options.allowdatere && object.prototype.tostring.call(options.allowdatere) === "[object regexp]"){ if(!options.allowdatere.test(datehelper.formatdate(start, options.formatdate))){ classes.push('xdsoft_disabled'); } } else if(options.allowdates && options.allowdates.length>0){ if(options.allowdates.indexof(datehelper.formatdate(start, options.formatdate)) === -1){ classes.push('xdsoft_disabled'); } } else if ((maxdate !== false && start > maxdate) || (mindate !== false && start < mindate) || (customdatesettings && customdatesettings[0] === false)) { classes.push('xdsoft_disabled'); } else if (options.disableddates.indexof(datehelper.formatdate(start, options.formatdate)) !== -1) { classes.push('xdsoft_disabled'); } else if (options.disabledweekdays.indexof(day) !== -1) { classes.push('xdsoft_disabled'); }else if (input.is('[readonly]')) { classes.push('xdsoft_disabled'); } if (customdatesettings && customdatesettings[1] !== "") { classes.push(customdatesettings[1]); } if (_xdsoft_datetime.currenttime.getmonth() !== m) { classes.push('xdsoft_other_month'); } if ((options.defaultselect || datetimepicker.data('changed')) && datehelper.formatdate(_xdsoft_datetime.currenttime, options.formatdate) === datehelper.formatdate(start, options.formatdate)) { classes.push('xdsoft_current'); } if (datehelper.formatdate(today, options.formatdate) === datehelper.formatdate(start, options.formatdate)) { classes.push('xdsoft_today'); } if (start.getday() === 0 || start.getday() === 6 || options.weekends.indexof(datehelper.formatdate(start, options.formatdate)) !== -1) { classes.push('xdsoft_weekend'); } if (options.highlighteddates[datehelper.formatdate(start, options.formatdate)] !== undefined) { hdate = options.highlighteddates[datehelper.formatdate(start, options.formatdate)]; classes.push(hdate.style === undefined ? 'xdsoft_highlighted_default' : hdate.style); description = hdate.desc === undefined ? '' : hdate.desc; } if (options.beforeshowday && $.isfunction(options.beforeshowday)) { classes.push(options.beforeshowday(start)); } if (newrow) { table += ''; newrow = false; if (options.weeks) { table += ''; } } table += ''; if (start.getday() === options.dayofweekstartprev) { table += ''; newrow = true; } start.setdate(d + 1); } table += '
' + options.i18n[globallocale].dayofweekshort[(j + options.dayofweekstart) % 7] + '
' + w + '' + '
' + d + '
' + '
'; calendar.html(table); mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globallocale].months[_xdsoft_datetime.currenttime.getmonth()]); mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currenttime.getfullyear()); // generate timebox time = ''; h = ''; m = ''; line_time = function line_time(h, m) { var now = _xdsoft_datetime.now(), optiondatetime, current_time, isallowtimesinit = options.allowtimes && $.isarray(options.allowtimes) && options.allowtimes.length; now.sethours(h); h = parseint(now.gethours(), 10); now.setminutes(m); m = parseint(now.getminutes(), 10); optiondatetime = new date(_xdsoft_datetime.currenttime); optiondatetime.sethours(h); optiondatetime.setminutes(m); classes = []; if ((options.mindatetime !== false && options.mindatetime > optiondatetime) || (options.maxtime !== false && _xdsoft_datetime.strtotime(options.maxtime).gettime() < now.gettime()) || (options.mintime !== false && _xdsoft_datetime.strtotime(options.mintime).gettime() > now.gettime())) { classes.push('xdsoft_disabled'); } else if ((options.mindatetime !== false && options.mindatetime > optiondatetime) || ((options.disabledmintime !== false && now.gettime() > _xdsoft_datetime.strtotime(options.disabledmintime).gettime()) && (options.disabledmaxtime !== false && now.gettime() < _xdsoft_datetime.strtotime(options.disabledmaxtime).gettime()))) { classes.push('xdsoft_disabled'); } else if (input.is('[readonly]')) { classes.push('xdsoft_disabled'); } current_time = new date(_xdsoft_datetime.currenttime); current_time.sethours(parseint(_xdsoft_datetime.currenttime.gethours(), 10)); 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) && ((!isallowtimesinit && options.step > 59) || current_time.getminutes() === parseint(m, 10))) { if (options.defaultselect || datetimepicker.data('changed')) { classes.push('xdsoft_current'); } else if (options.inittime) { classes.push('xdsoft_init_time'); } } if (parseint(today.gethours(), 10) === parseint(h, 10) && parseint(today.getminutes(), 10) === parseint(m, 10)) { classes.push('xdsoft_today'); } time += '
' + datehelper.formatdate(now, options.formattime) + '
'; }; if (!options.allowtimes || !$.isarray(options.allowtimes) || !options.allowtimes.length) { for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) { for (j = 0; j < 60; j += options.step) { h = (i < 10 ? '0' : '') + i; m = (j < 10 ? '0' : '') + j; line_time(h, m); } } } else { for (i = 0; i < options.allowtimes.length; i += 1) { h = _xdsoft_datetime.strtotime(options.allowtimes[i]).gethours(); m = _xdsoft_datetime.strtotime(options.allowtimes[i]).getminutes(); line_time(h, m); } } timebox.html(time); opt = ''; i = 0; for (i = parseint(options.yearstart, 10) + options.yearoffset; i <= parseint(options.yearend, 10) + options.yearoffset; i += 1) { opt += '
' + i + '
'; } yearselect.children().eq(0) .html(opt); for (i = parseint(options.monthstart, 10), opt = ''; i <= parseint(options.monthend, 10); i += 1) { opt += '
' + options.i18n[globallocale].months[i] + '
'; } monthselect.children().eq(0).html(opt); $(datetimepicker) .trigger('generate.xdsoft'); }, 10); event.stoppropagation(); }) .on('afteropen.xdsoft', function () { if (options.timepicker) { var classtype, pheight, height, top; if (timebox.find('.xdsoft_current').length) { classtype = '.xdsoft_current'; } else if (timebox.find('.xdsoft_init_time').length) { classtype = '.xdsoft_init_time'; } if (classtype) { pheight = timeboxparent[0].clientheight; height = timebox[0].offsetheight; top = timebox.find(classtype).index() * options.timeheightintimepicker + 1; if ((height - pheight) < top) { top = height - pheight; } timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseint(top, 10) / (height - pheight)]); } else { timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]); } } }); timerclick = 0; calendar .on('touchend click.xdsoft', 'td', function (xdevent) { xdevent.stoppropagation(); // prevents closing of pop-ups, modals and flyouts in bootstrap timerclick += 1; var $this = $(this), currenttime = _xdsoft_datetime.currenttime; if (currenttime === undefined || currenttime === null) { _xdsoft_datetime.currenttime = _xdsoft_datetime.now(); currenttime = _xdsoft_datetime.currenttime; } if ($this.hasclass('xdsoft_disabled')) { return false; } currenttime.setdate(1); currenttime.setfullyear($this.data('year')); currenttime.setmonth($this.data('month')); currenttime.setdate($this.data('date')); datetimepicker.trigger('select.xdsoft', [currenttime]); input.val(_xdsoft_datetime.str()); if (options.onselectdate && $.isfunction(options.onselectdate)) { options.onselectdate.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input'), xdevent); } datetimepicker.data('changed', true); datetimepicker.trigger('xchange.xdsoft'); datetimepicker.trigger('changedatetime.xdsoft'); if ((timerclick > 1 || (options.closeondateselect === true || (options.closeondateselect === false && !options.timepicker))) && !options.inline) { datetimepicker.trigger('close.xdsoft'); } settimeout(function () { timerclick = 0; }, 200); }); timebox .on('touchend click.xdsoft', 'div', function (xdevent) { xdevent.stoppropagation(); var $this = $(this), currenttime = _xdsoft_datetime.currenttime; if (currenttime === undefined || currenttime === null) { _xdsoft_datetime.currenttime = _xdsoft_datetime.now(); currenttime = _xdsoft_datetime.currenttime; } if ($this.hasclass('xdsoft_disabled')) { return false; } currenttime.sethours($this.data('hour')); currenttime.setminutes($this.data('minute')); datetimepicker.trigger('select.xdsoft', [currenttime]); datetimepicker.data('input').val(_xdsoft_datetime.str()); if (options.onselecttime && $.isfunction(options.onselecttime)) { options.onselecttime.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input'), xdevent); } datetimepicker.data('changed', true); datetimepicker.trigger('xchange.xdsoft'); datetimepicker.trigger('changedatetime.xdsoft'); if (options.inline !== true && options.closeontimeselect === true) { datetimepicker.trigger('close.xdsoft'); } }); datepicker .on('mousewheel.xdsoft', function (event) { if (!options.scrollmonth) { return true; } if (event.deltay < 0) { _xdsoft_datetime.nextmonth(); } else { _xdsoft_datetime.prevmonth(); } return false; }); input .on('mousewheel.xdsoft', function (event) { if (!options.scrollinput) { return true; } if (!options.datepicker && options.timepicker) { current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0; if (current_time_index + event.deltay >= 0 && current_time_index + event.deltay < timebox.children().length) { current_time_index += event.deltay; } if (timebox.children().eq(current_time_index).length) { timebox.children().eq(current_time_index).trigger('mousedown'); } return false; } if (options.datepicker && !options.timepicker) { datepicker.trigger(event, [event.deltay, event.deltax, event.deltay]); if (input.val) { input.val(_xdsoft_datetime.str()); } datetimepicker.trigger('changedatetime.xdsoft'); return false; } }); datetimepicker .on('changedatetime.xdsoft', function (event) { if (options.onchangedatetime && $.isfunction(options.onchangedatetime)) { var $input = datetimepicker.data('input'); options.onchangedatetime.call(datetimepicker, _xdsoft_datetime.currenttime, $input, event); delete options.value; $input.trigger('change'); } }) .on('generate.xdsoft', function () { if (options.ongenerate && $.isfunction(options.ongenerate)) { options.ongenerate.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input')); } if (triggerafteropen) { datetimepicker.trigger('afteropen.xdsoft'); triggerafteropen = false; } }) .on('click.xdsoft', function (xdevent) { xdevent.stoppropagation(); }); current_time_index = 0; /** * runs the callback for each of the specified node's ancestors. * * return false from the callback to stop ascending. * * @param {domnode} node * @param {function} callback * @returns {undefined} */ foreachancestorof = function (node, callback) { do { node = node.parentnode; if (callback(node) === false) { break; } } while (node.nodename !== 'html'); }; /** * sets the position of the picker. * * @returns {undefined} */ setpos = function () { var dateinputoffset, dateinputelem, verticalposition, left, position, datetimepickerelem, dateinputhasfixedancestor, $dateinput, windowwidth, verticalanchoredge, datetimepickercss, windowheight, windowscrolltop; $dateinput = datetimepicker.data('input'); dateinputoffset = $dateinput.offset(); dateinputelem = $dateinput[0]; verticalanchoredge = 'top'; verticalposition = (dateinputoffset.top + dateinputelem.offsetheight) - 1; left = dateinputoffset.left; position = "absolute"; windowwidth = $(window).width(); windowheight = $(window).height(); windowscrolltop = $(window).scrolltop(); if ((document.documentelement.clientwidth - dateinputoffset.left) < datepicker.parent().outerwidth(true)) { var diff = datepicker.parent().outerwidth(true) - dateinputelem.offsetwidth; left = left - diff; } if ($dateinput.parent().css('direction') === 'rtl') { left -= (datetimepicker.outerwidth() - $dateinput.outerwidth()); } if (options.fixed) { verticalposition -= windowscrolltop; left -= $(window).scrollleft(); position = "fixed"; } else { dateinputhasfixedancestor = false; foreachancestorof(dateinputelem, function (ancestornode) { if (window.getcomputedstyle(ancestornode).getpropertyvalue('position') === 'fixed') { dateinputhasfixedancestor = true; return false; } }); if (dateinputhasfixedancestor) { position = 'fixed'; //if the picker won't fit entirely within the viewport then display it above the date input. if (verticalposition + datetimepicker.outerheight() > windowheight + windowscrolltop) { verticalanchoredge = 'bottom'; verticalposition = (windowheight + windowscrolltop) - dateinputoffset.top; } else { verticalposition -= windowscrolltop; } } else { if (verticalposition + dateinputelem.offsetheight > windowheight + windowscrolltop) { verticalposition = dateinputoffset.top - dateinputelem.offsetheight + 1; } } if (verticalposition < 0) { verticalposition = 0; } if (left + dateinputelem.offsetwidth > windowwidth) { left = windowwidth - dateinputelem.offsetwidth; } } datetimepickerelem = datetimepicker[0]; foreachancestorof(datetimepickerelem, function (ancestornode) { var ancestornodeposition; ancestornodeposition = window.getcomputedstyle(ancestornode).getpropertyvalue('position'); if (ancestornodeposition === 'relative' && windowwidth >= ancestornode.offsetwidth) { left = left - ((windowwidth - ancestornode.offsetwidth) / 2); return false; } }); datetimepickercss = { position: position, left: left, top: '', //initialize to prevent previous values interfering with new ones. bottom: '' //initialize to prevent previous values interfering with new ones. }; datetimepickercss[verticalanchoredge] = verticalposition; datetimepicker.css(datetimepickercss); }; datetimepicker .on('open.xdsoft', function (event) { var onshow = true; if (options.onshow && $.isfunction(options.onshow)) { onshow = options.onshow.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input'), event); } if (onshow !== false) { datetimepicker.show(); setpos(); $(window) .off('resize.xdsoft', setpos) .on('resize.xdsoft', setpos); if (options.closeonwithoutclick) { $([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() { datetimepicker.trigger('close.xdsoft'); $([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6); }); } } }) .on('close.xdsoft', function (event) { var onclose = true; mounth_picker .find('.xdsoft_month,.xdsoft_year') .find('.xdsoft_select') .hide(); if (options.onclose && $.isfunction(options.onclose)) { onclose = options.onclose.call(datetimepicker, _xdsoft_datetime.currenttime, datetimepicker.data('input'), event); } if (onclose !== false && !options.opened && !options.inline) { datetimepicker.hide(); } event.stoppropagation(); }) .on('toggle.xdsoft', function () { if (datetimepicker.is(':visible')) { datetimepicker.trigger('close.xdsoft'); } else { datetimepicker.trigger('open.xdsoft'); } }) .data('input', input); timer = 0; datetimepicker.data('xdsoft_datetime', _xdsoft_datetime); datetimepicker.setoptions(options); function getcurrentvalue() { var ct = false, time; if (options.startdate) { ct = _xdsoft_datetime.strtodate(options.startdate); } else { ct = options.value || ((input && input.val && input.val()) ? input.val() : ''); if (ct) { ct = _xdsoft_datetime.strtodatetime(ct); } else if (options.defaultdate) { ct = _xdsoft_datetime.strtodatetime(options.defaultdate); if (options.defaulttime) { time = _xdsoft_datetime.strtotime(options.defaulttime); ct.sethours(time.gethours()); ct.setminutes(time.getminutes()); } } } if (ct && _xdsoft_datetime.isvaliddate(ct)) { datetimepicker.data('changed', true); } else { ct = ''; } return ct || 0; } function setmask(options) { var isvalidvalue = function (mask, value) { var reg = mask .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') .replace(/_/g, '{digit+}') .replace(/([0-9]{1})/g, '{digit$1}') .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); return (new regexp(reg)).test(value); }, getcaretpos = function (input) { try { if (document.selection && document.selection.createrange) { var range = document.selection.createrange(); return range.getbookmark().charcodeat(2) - 2; } if (input.setselectionrange) { return input.selectionstart; } } catch (e) { return 0; } }, setcaretpos = function (node, pos) { node = (typeof node === "string" || node instanceof string) ? document.getelementbyid(node) : node; if (!node) { return false; } if (node.createtextrange) { var textrange = node.createtextrange(); textrange.collapse(true); textrange.moveend('character', pos); textrange.movestart('character', pos); textrange.select(); return true; } if (node.setselectionrange) { node.setselectionrange(pos, pos); return true; } return false; }; if(options.mask) { input.off('keydown.xdsoft'); } if (options.mask === true) { if (typeof moment != 'undefined') { options.mask = options.format .replace(/y{4}/g, '9999') .replace(/y{2}/g, '99') .replace(/m{2}/g, '19') .replace(/d{2}/g, '39') .replace(/h{2}/g, '29') .replace(/m{2}/g, '59') .replace(/s{2}/g, '59'); } else { options.mask = options.format .replace(/y/g, '9999') .replace(/f/g, '9999') .replace(/m/g, '19') .replace(/d/g, '39') .replace(/h/g, '29') .replace(/i/g, '59') .replace(/s/g, '59'); } } if ($.type(options.mask) === 'string') { if (!isvalidvalue(options.mask, input.val())) { input.val(options.mask.replace(/[0-9]/g, '_')); setcaretpos(input[0], 0); } input.on('keydown.xdsoft', function (event) { var val = this.value, key = event.which, pos, digit; if (((key >= key0 && key <= key9) || (key >= _key0 && key <= _key9)) || (key === backspace || key === del)) { pos = getcaretpos(this); digit = (key !== backspace && key !== del) ? string.fromcharcode((_key0 <= key && key <= _key9) ? key - key0 : key) : '_'; if ((key === backspace || key === del) && pos) { pos -= 1; digit = '_'; } while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { pos += (key === backspace || key === del) ? -1 : 1; } val = val.substr(0, pos) + digit + val.substr(pos + 1); if ($.trim(val) === '') { val = options.mask.replace(/[0-9]/g, '_'); } else { if (pos === options.mask.length) { event.preventdefault(); return false; } } pos += (key === backspace || key === del) ? 0 : 1; while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { pos += (key === backspace || key === del) ? -1 : 1; } if (isvalidvalue(options.mask, val)) { this.value = val; setcaretpos(this, pos); } else if ($.trim(val) === '') { this.value = options.mask.replace(/[0-9]/g, '_'); } else { input.trigger('error_input.xdsoft'); } } else { if (([akey, ckey, vkey, zkey, ykey].indexof(key) !== -1 && ctrldown) || [esc, arrowup, arrowdown, arrowleft, arrowright, f5, ctrlkey, tab, enter].indexof(key) !== -1) { return true; } } event.preventdefault(); return false; }); } } _xdsoft_datetime.setcurrenttime(getcurrentvalue()); input .data('xdsoft_datetimepicker', datetimepicker) .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () { if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeoninputclick)) { return; } cleartimeout(timer); timer = settimeout(function () { if (input.is(':disabled')) { return; } triggerafteropen = true; _xdsoft_datetime.setcurrenttime(getcurrentvalue()); if(options.mask) { setmask(options); } datetimepicker.trigger('open.xdsoft'); }, 100); }) .on('keydown.xdsoft', function (event) { var elementselector, key = event.which; if ([enter].indexof(key) !== -1 && options.enterliketab) { elementselector = $("input:visible,textarea:visible,button:visible,a:visible"); datetimepicker.trigger('close.xdsoft'); elementselector.eq(elementselector.index(this) + 1).focus(); return false; } if ([tab].indexof(key) !== -1) { datetimepicker.trigger('close.xdsoft'); return true; } }) .on('blur.xdsoft', function () { datetimepicker.trigger('close.xdsoft'); }); }; destroydatetimepicker = function (input) { var datetimepicker = input.data('xdsoft_datetimepicker'); if (datetimepicker) { datetimepicker.data('xdsoft_datetime', null); datetimepicker.remove(); input .data('xdsoft_datetimepicker', null) .off('.xdsoft'); $(window).off('resize.xdsoft'); $([window, document.body]).off('mousedown.xdsoft touchstart'); if (input.unmousewheel) { input.unmousewheel(); } } }; $(document) .off('keydown.xdsoftctrl keyup.xdsoftctrl') .on('keydown.xdsoftctrl', function (e) { if (e.keycode === ctrlkey) { ctrldown = true; } }) .on('keyup.xdsoftctrl', function (e) { if (e.keycode === ctrlkey) { ctrldown = false; } }); this.each(function () { var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; if (datetimepicker) { if ($.type(opt) === 'string') { switch (opt) { case 'show': $(this).select().focus(); datetimepicker.trigger('open.xdsoft'); break; case 'hide': datetimepicker.trigger('close.xdsoft'); break; case 'toggle': datetimepicker.trigger('toggle.xdsoft'); break; case 'destroy': destroydatetimepicker($(this)); break; case 'reset': this.value = this.defaultvalue; if (!this.value || !datetimepicker.data('xdsoft_datetime').isvaliddate(datehelper.parsedate(this.value, options.format))) { datetimepicker.data('changed', false); } datetimepicker.data('xdsoft_datetime').setcurrenttime(this.value); break; case 'validate': $input = datetimepicker.data('input'); $input.trigger('blur.xdsoft'); break; default: if (datetimepicker[opt] && $.isfunction(datetimepicker[opt])) { result = datetimepicker[opt](opt2); } } } else { datetimepicker .setoptions(opt); } return 0; } if ($.type(opt) !== 'string') { if (!options.lazyinit || options.open || options.inline) { createdatetimepicker($(this)); } else { lazyinit($(this)); } } }); return result; }; $.fn.datetimepicker.defaults = default_options; function highlighteddate(date, desc, style) { "use strict"; this.date = date; this.desc = desc; this.style = style; } })); /*! * jquery mousewheel 3.1.13 * * copyright jquery foundation and other contributors * released under the mit license * http://jquery.org/license */ (function (factory) { if ( typeof define === 'function' && define.amd ) { // amd. register as an anonymous module. define(['jquery'], factory); } else if (typeof exports === 'object') { // node/commonjs style for browserify module.exports = factory; } else { // browser globals factory(jquery); } }(function ($) { var tofix = ['wheel', 'mousewheel', 'dommousescroll', 'mozmousepixelscroll'], tobind = ( 'onwheel' in document || document.documentmode >= 9 ) ? ['wheel'] : ['mousewheel', 'dommousescroll', 'mozmousepixelscroll'], slice = array.prototype.slice, nulllowestdeltatimeout, lowestdelta; if ( $.event.fixhooks ) { for ( var i = tofix.length; i; ) { $.event.fixhooks[ tofix[--i] ] = $.event.mousehooks; } } var special = $.event.special.mousewheel = { version: '3.1.12', setup: function() { if ( this.addeventlistener ) { for ( var i = tobind.length; i; ) { this.addeventlistener( tobind[--i], handler, false ); } } else { this.onmousewheel = handler; } // store the line height and page height for this particular element $.data(this, 'mousewheel-line-height', special.getlineheight(this)); $.data(this, 'mousewheel-page-height', special.getpageheight(this)); }, teardown: function() { if ( this.removeeventlistener ) { for ( var i = tobind.length; i; ) { this.removeeventlistener( tobind[--i], handler, false ); } } else { this.onmousewheel = null; } // clean up the data we added to the element $.removedata(this, 'mousewheel-line-height'); $.removedata(this, 'mousewheel-page-height'); }, getlineheight: function(elem) { var $elem = $(elem), $parent = $elem['offsetparent' in $.fn ? 'offsetparent' : 'parent'](); if (!$parent.length) { $parent = $('body'); } return parseint($parent.css('fontsize'), 10) || parseint($elem.css('fontsize'), 10) || 16; }, getpageheight: function(elem) { return $(elem).height(); }, settings: { adjustolddeltas: true, // see shouldadjustolddeltas() below normalizeoffset: true // calls getboundingclientrect for each event } }; $.fn.extend({ mousewheel: function(fn) { return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); }, unmousewheel: function(fn) { return this.unbind('mousewheel', fn); } }); function handler(event) { var orgevent = event || window.event, args = slice.call(arguments, 1), delta = 0, deltax = 0, deltay = 0, absdelta = 0, offsetx = 0, offsety = 0; event = $.event.fix(orgevent); event.type = 'mousewheel'; // old school scrollwheel delta if ( 'detail' in orgevent ) { deltay = orgevent.detail * -1; } if ( 'wheeldelta' in orgevent ) { deltay = orgevent.wheeldelta; } if ( 'wheeldeltay' in orgevent ) { deltay = orgevent.wheeldeltay; } if ( 'wheeldeltax' in orgevent ) { deltax = orgevent.wheeldeltax * -1; } // firefox < 17 horizontal scrolling related to dommousescroll event if ( 'axis' in orgevent && orgevent.axis === orgevent.horizontal_axis ) { deltax = deltay * -1; deltay = 0; } // set delta to be deltay or deltax if deltay is 0 for backwards compatabilitiy delta = deltay === 0 ? deltax : deltay; // new school wheel delta (wheel event) if ( 'deltay' in orgevent ) { deltay = orgevent.deltay * -1; delta = deltay; } if ( 'deltax' in orgevent ) { deltax = orgevent.deltax; if ( deltay === 0 ) { delta = deltax * -1; } } // no change actually happened, no reason to go any further if ( deltay === 0 && deltax === 0 ) { return; } // need to convert lines and pages to pixels if we aren't already in pixels // there are three delta modes: // * deltamode 0 is by pixels, nothing to do // * deltamode 1 is by lines // * deltamode 2 is by pages if ( orgevent.deltamode === 1 ) { var lineheight = $.data(this, 'mousewheel-line-height'); delta *= lineheight; deltay *= lineheight; deltax *= lineheight; } else if ( orgevent.deltamode === 2 ) { var pageheight = $.data(this, 'mousewheel-page-height'); delta *= pageheight; deltay *= pageheight; deltax *= pageheight; } // store lowest absolute delta to normalize the delta values absdelta = math.max( math.abs(deltay), math.abs(deltax) ); if ( !lowestdelta || absdelta < lowestdelta ) { lowestdelta = absdelta; // adjust older deltas if necessary if ( shouldadjustolddeltas(orgevent, absdelta) ) { lowestdelta /= 40; } } // adjust older deltas if necessary if ( shouldadjustolddeltas(orgevent, absdelta) ) { // divide all the things by 40! delta /= 40; deltax /= 40; deltay /= 40; } // get a whole, normalized value for the deltas delta = math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestdelta); deltax = math[ deltax >= 1 ? 'floor' : 'ceil' ](deltax / lowestdelta); deltay = math[ deltay >= 1 ? 'floor' : 'ceil' ](deltay / lowestdelta); // normalise offsetx and offsety properties if ( special.settings.normalizeoffset && this.getboundingclientrect ) { var boundingrect = this.getboundingclientrect(); offsetx = event.clientx - boundingrect.left; offsety = event.clienty - boundingrect.top; } // add information to the event object event.deltax = deltax; event.deltay = deltay; event.deltafactor = lowestdelta; event.offsetx = offsetx; event.offsety = offsety; // go ahead and set deltamode to 0 since we converted to pixels // although this is a little odd since we overwrite the deltax/y // properties with normalized deltas. event.deltamode = 0; // add event and delta to the front of the arguments args.unshift(event, delta, deltax, deltay); // clearout lowestdelta after sometime to better // handle multiple device types that give different // a different lowestdelta // ex: trackpad = 3 and mouse wheel = 120 if (nulllowestdeltatimeout) { cleartimeout(nulllowestdeltatimeout); } nulllowestdeltatimeout = settimeout(nulllowestdelta, 200); return ($.event.dispatch || $.event.handle).apply(this, args); } function nulllowestdelta() { lowestdelta = null; } function shouldadjustolddeltas(orgevent, absdelta) { // if this is an older event and the delta is divisable by 120, // then we are assuming that the browser is treating this as an // older mouse wheel event and that we should divide the deltas // by 40 to try and get a more usable deltafactor. // side note, this actually impacts the reported scroll distance // in older browsers and can cause scrolling to be slower than native. // turn this off by setting $.event.special.mousewheel.settings.adjustolddeltas to false. return special.settings.adjustolddeltas && orgevent.type === 'mousewheel' && absdelta % 120 === 0; } }));