xdan-datetimepicker-rails 2.4.6 → 2.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3034 @@
1
+ /*!
2
+ * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2015
3
+ * @version 1.3.3
4
+ *
5
+ * Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
6
+ * @see http://php.net/manual/en/function.date.php
7
+ *
8
+ * For more JQuery plugins visit http://plugins.krajee.com
9
+ * For more Yii related demos visit http://demos.krajee.com
10
+ */
11
+ var DateFormatter;
12
+ (function () {
13
+ "use strict";
14
+
15
+ var _compare, _lpad, _extend, defaultSettings, DAY, HOUR;
16
+ DAY = 1000 * 60 * 60 * 24;
17
+ HOUR = 3600;
18
+
19
+ _compare = function (str1, str2) {
20
+ return typeof(str1) === 'string' && typeof(str2) === 'string' && str1.toLowerCase() === str2.toLowerCase();
21
+ };
22
+ _lpad = function (value, length, char) {
23
+ var chr = char || '0', val = value.toString();
24
+ return val.length < length ? _lpad(chr + val, length) : val;
25
+ };
26
+ _extend = function (out) {
27
+ var i, obj;
28
+ out = out || {};
29
+ for (i = 1; i < arguments.length; i++) {
30
+ obj = arguments[i];
31
+ if (!obj) {
32
+ continue;
33
+ }
34
+ for (var key in obj) {
35
+ if (obj.hasOwnProperty(key)) {
36
+ if (typeof obj[key] === 'object') {
37
+ _extend(out[key], obj[key]);
38
+ } else {
39
+ out[key] = obj[key];
40
+ }
41
+ }
42
+ }
43
+ }
44
+ return out;
45
+ };
46
+ defaultSettings = {
47
+ dateSettings: {
48
+ days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
49
+ daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
50
+ months: [
51
+ 'January', 'February', 'March', 'April', 'May', 'June', 'July',
52
+ 'August', 'September', 'October', 'November', 'December'
53
+ ],
54
+ monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
55
+ meridiem: ['AM', 'PM'],
56
+ ordinal: function (number) {
57
+ var n = number % 10, suffixes = {1: 'st', 2: 'nd', 3: 'rd'};
58
+ return Math.floor(number % 100 / 10) === 1 || !suffixes[n] ? 'th' : suffixes[n];
59
+ }
60
+ },
61
+ separators: /[ \-+\/\.T:@]/g,
62
+ validParts: /[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,
63
+ intParts: /[djwNzmnyYhHgGis]/g,
64
+ tzParts: /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
65
+ tzClip: /[^-+\dA-Z]/g
66
+ };
67
+
68
+ DateFormatter = function (options) {
69
+ var self = this, config = _extend(defaultSettings, options);
70
+ self.dateSettings = config.dateSettings;
71
+ self.separators = config.separators;
72
+ self.validParts = config.validParts;
73
+ self.intParts = config.intParts;
74
+ self.tzParts = config.tzParts;
75
+ self.tzClip = config.tzClip;
76
+ };
77
+
78
+ DateFormatter.prototype = {
79
+ constructor: DateFormatter,
80
+ parseDate: function (vDate, vFormat) {
81
+ var self = this, vFormatParts, vDateParts, i, vDateFlag = false, vTimeFlag = false, vDatePart, iDatePart,
82
+ vSettings = self.dateSettings, vMonth, vMeriIndex, vMeriOffset, len, mer,
83
+ out = {date: null, year: null, month: null, day: null, hour: 0, min: 0, sec: 0};
84
+ if (!vDate) {
85
+ return undefined;
86
+ }
87
+ if (vDate instanceof Date) {
88
+ return vDate;
89
+ }
90
+ if (typeof vDate === 'number') {
91
+ return new Date(vDate);
92
+ }
93
+ if (vFormat === 'U') {
94
+ i = parseInt(vDate);
95
+ return i ? new Date(i * 1000) : vDate;
96
+ }
97
+ if (typeof vDate !== 'string') {
98
+ return '';
99
+ }
100
+ vFormatParts = vFormat.match(self.validParts);
101
+ if (!vFormatParts || vFormatParts.length === 0) {
102
+ throw new Error("Invalid date format definition.");
103
+ }
104
+ vDateParts = vDate.replace(self.separators, '\0').split('\0');
105
+ for (i = 0; i < vDateParts.length; i++) {
106
+ vDatePart = vDateParts[i];
107
+ iDatePart = parseInt(vDatePart);
108
+ switch (vFormatParts[i]) {
109
+ case 'y':
110
+ case 'Y':
111
+ len = vDatePart.length;
112
+ if (len === 2) {
113
+ out.year = parseInt((iDatePart < 70 ? '20' : '19') + vDatePart);
114
+ } else if (len === 4) {
115
+ out.year = iDatePart;
116
+ }
117
+ vDateFlag = true;
118
+ break;
119
+ case 'm':
120
+ case 'n':
121
+ case 'M':
122
+ case 'F':
123
+ if (isNaN(vDatePart)) {
124
+ vMonth = vSettings.monthsShort.indexOf(vDatePart);
125
+ if (vMonth > -1) {
126
+ out.month = vMonth + 1;
127
+ }
128
+ vMonth = vSettings.months.indexOf(vDatePart);
129
+ if (vMonth > -1) {
130
+ out.month = vMonth + 1;
131
+ }
132
+ } else {
133
+ if (iDatePart >= 1 && iDatePart <= 12) {
134
+ out.month = iDatePart;
135
+ }
136
+ }
137
+ vDateFlag = true;
138
+ break;
139
+ case 'd':
140
+ case 'j':
141
+ if (iDatePart >= 1 && iDatePart <= 31) {
142
+ out.day = iDatePart;
143
+ }
144
+ vDateFlag = true;
145
+ break;
146
+ case 'g':
147
+ case 'h':
148
+ vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') :
149
+ (vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1;
150
+ mer = vDateParts[vMeriIndex];
151
+ if (vMeriIndex > -1) {
152
+ vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 :
153
+ (_compare(mer, vSettings.meridiem[1]) ? 12 : -1);
154
+ if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset > -1) {
155
+ out.hour = iDatePart + vMeriOffset - 1;
156
+ } else if (iDatePart >= 0 && iDatePart <= 23) {
157
+ out.hour = iDatePart;
158
+ }
159
+ } else if (iDatePart >= 0 && iDatePart <= 23) {
160
+ out.hour = iDatePart;
161
+ }
162
+ vTimeFlag = true;
163
+ break;
164
+ case 'G':
165
+ case 'H':
166
+ if (iDatePart >= 0 && iDatePart <= 23) {
167
+ out.hour = iDatePart;
168
+ }
169
+ vTimeFlag = true;
170
+ break;
171
+ case 'i':
172
+ if (iDatePart >= 0 && iDatePart <= 59) {
173
+ out.min = iDatePart;
174
+ }
175
+ vTimeFlag = true;
176
+ break;
177
+ case 's':
178
+ if (iDatePart >= 0 && iDatePart <= 59) {
179
+ out.sec = iDatePart;
180
+ }
181
+ vTimeFlag = true;
182
+ break;
183
+ }
184
+ }
185
+ if (vDateFlag === true && out.year && out.month && out.day) {
186
+ out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0);
187
+ } else {
188
+ if (vTimeFlag !== true) {
189
+ return false;
190
+ }
191
+ out.date = new Date(0, 0, 0, out.hour, out.min, out.sec, 0);
192
+ }
193
+ return out.date;
194
+ },
195
+ guessDate: function (vDateStr, vFormat) {
196
+ if (typeof vDateStr !== 'string') {
197
+ return vDateStr;
198
+ }
199
+ var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g,
200
+ vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, iPart, iSec;
201
+
202
+ if (!vPattern.test(vFormatParts[0])) {
203
+ return vDateStr;
204
+ }
205
+
206
+ for (i = 0; i < vParts.length; i++) {
207
+ vDigit = 2;
208
+ iPart = vParts[i];
209
+ iSec = parseInt(iPart.substr(0, 2));
210
+ switch (i) {
211
+ case 0:
212
+ if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
213
+ vDate.setMonth(iSec - 1);
214
+ } else {
215
+ vDate.setDate(iSec);
216
+ }
217
+ break;
218
+ case 1:
219
+ if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
220
+ vDate.setDate(iSec);
221
+ } else {
222
+ vDate.setMonth(iSec - 1);
223
+ }
224
+ break;
225
+ case 2:
226
+ vYear = vDate.getFullYear();
227
+ if (iPart.length < 4) {
228
+ vDate.setFullYear(parseInt(vYear.toString().substr(0, 4 - iPart.length) + iPart));
229
+ vDigit = iPart.length;
230
+ } else {
231
+ vDate.setFullYear = parseInt(iPart.substr(0, 4));
232
+ vDigit = 4;
233
+ }
234
+ break;
235
+ case 3:
236
+ vDate.setHours(iSec);
237
+ break;
238
+ case 4:
239
+ vDate.setMinutes(iSec);
240
+ break;
241
+ case 5:
242
+ vDate.setSeconds(iSec);
243
+ break;
244
+ }
245
+ if (iPart.substr(vDigit).length > 0) {
246
+ vParts.splice(i + 1, 0, iPart.substr(vDigit));
247
+ }
248
+ }
249
+ return vDate;
250
+ },
251
+ parseFormat: function (vChar, vDate) {
252
+ var self = this, vSettings = self.dateSettings, fmt, backspace = /\\?(.?)/gi, doFormat = function (t, s) {
253
+ return fmt[t] ? fmt[t]() : s;
254
+ };
255
+ fmt = {
256
+ /////////
257
+ // DAY //
258
+ /////////
259
+ /**
260
+ * Day of month with leading 0: `01..31`
261
+ * @return {string}
262
+ */
263
+ d: function () {
264
+ return _lpad(fmt.j(), 2);
265
+ },
266
+ /**
267
+ * Shorthand day name: `Mon...Sun`
268
+ * @return {string}
269
+ */
270
+ D: function () {
271
+ return vSettings.daysShort[fmt.w()];
272
+ },
273
+ /**
274
+ * Day of month: `1..31`
275
+ * @return {number}
276
+ */
277
+ j: function () {
278
+ return vDate.getDate();
279
+ },
280
+ /**
281
+ * Full day name: `Monday...Sunday`
282
+ * @return {number}
283
+ */
284
+ l: function () {
285
+ return vSettings.days[fmt.w()];
286
+ },
287
+ /**
288
+ * ISO-8601 day of week: `1[Mon]..7[Sun]`
289
+ * @return {number}
290
+ */
291
+ N: function () {
292
+ return fmt.w() || 7;
293
+ },
294
+ /**
295
+ * Day of week: `0[Sun]..6[Sat]`
296
+ * @return {number}
297
+ */
298
+ w: function () {
299
+ return vDate.getDay();
300
+ },
301
+ /**
302
+ * Day of year: `0..365`
303
+ * @return {number}
304
+ */
305
+ z: function () {
306
+ var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j()), b = new Date(fmt.Y(), 0, 1);
307
+ return Math.round((a - b) / DAY);
308
+ },
309
+
310
+ //////////
311
+ // WEEK //
312
+ //////////
313
+ /**
314
+ * ISO-8601 week number
315
+ * @return {number}
316
+ */
317
+ W: function () {
318
+ var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j() - fmt.N() + 3), b = new Date(a.getFullYear(), 0, 4);
319
+ return _lpad(1 + Math.round((a - b) / DAY / 7), 2);
320
+ },
321
+
322
+ ///////////
323
+ // MONTH //
324
+ ///////////
325
+ /**
326
+ * Full month name: `January...December`
327
+ * @return {string}
328
+ */
329
+ F: function () {
330
+ return vSettings.months[vDate.getMonth()];
331
+ },
332
+ /**
333
+ * Month w/leading 0: `01..12`
334
+ * @return {string}
335
+ */
336
+ m: function () {
337
+ return _lpad(fmt.n(), 2);
338
+ },
339
+ /**
340
+ * Shorthand month name; `Jan...Dec`
341
+ * @return {string}
342
+ */
343
+ M: function () {
344
+ return vSettings.monthsShort[vDate.getMonth()];
345
+ },
346
+ /**
347
+ * Month: `1...12`
348
+ * @return {number}
349
+ */
350
+ n: function () {
351
+ return vDate.getMonth() + 1;
352
+ },
353
+ /**
354
+ * Days in month: `28...31`
355
+ * @return {number}
356
+ */
357
+ t: function () {
358
+ return (new Date(fmt.Y(), fmt.n(), 0)).getDate();
359
+ },
360
+
361
+ //////////
362
+ // YEAR //
363
+ //////////
364
+ /**
365
+ * Is leap year? `0 or 1`
366
+ * @return {number}
367
+ */
368
+ L: function () {
369
+ var Y = fmt.Y();
370
+ return (Y % 4 === 0 && Y % 100 !== 0 || Y % 400 === 0) ? 1 : 0;
371
+ },
372
+ /**
373
+ * ISO-8601 year
374
+ * @return {number}
375
+ */
376
+ o: function () {
377
+ var n = fmt.n(), W = fmt.W(), Y = fmt.Y();
378
+ return Y + (n === 12 && W < 9 ? 1 : n === 1 && W > 9 ? -1 : 0);
379
+ },
380
+ /**
381
+ * Full year: `e.g. 1980...2010`
382
+ * @return {number}
383
+ */
384
+ Y: function () {
385
+ return vDate.getFullYear();
386
+ },
387
+ /**
388
+ * Last two digits of year: `00...99`
389
+ * @return {string}
390
+ */
391
+ y: function () {
392
+ return fmt.Y().toString().slice(-2);
393
+ },
394
+
395
+ //////////
396
+ // TIME //
397
+ //////////
398
+ /**
399
+ * Meridian lower: `am or pm`
400
+ * @return {string}
401
+ */
402
+ a: function () {
403
+ return fmt.A().toLowerCase();
404
+ },
405
+ /**
406
+ * Meridian upper: `AM or PM`
407
+ * @return {string}
408
+ */
409
+ A: function () {
410
+ var n = fmt.G() < 12 ? 0 : 1;
411
+ return vSettings.meridiem[n];
412
+ },
413
+ /**
414
+ * Swatch Internet time: `000..999`
415
+ * @return {string}
416
+ */
417
+ B: function () {
418
+ var H = vDate.getUTCHours() * HOUR, i = vDate.getUTCMinutes() * 60, s = vDate.getUTCSeconds();
419
+ return _lpad(Math.floor((H + i + s + HOUR) / 86.4) % 1000, 3);
420
+ },
421
+ /**
422
+ * 12-Hours: `1..12`
423
+ * @return {number}
424
+ */
425
+ g: function () {
426
+ return fmt.G() % 12 || 12;
427
+ },
428
+ /**
429
+ * 24-Hours: `0..23`
430
+ * @return {number}
431
+ */
432
+ G: function () {
433
+ return vDate.getHours();
434
+ },
435
+ /**
436
+ * 12-Hours with leading 0: `01..12`
437
+ * @return {string}
438
+ */
439
+ h: function () {
440
+ return _lpad(fmt.g(), 2);
441
+ },
442
+ /**
443
+ * 24-Hours w/leading 0: `00..23`
444
+ * @return {string}
445
+ */
446
+ H: function () {
447
+ return _lpad(fmt.G(), 2);
448
+ },
449
+ /**
450
+ * Minutes w/leading 0: `00..59`
451
+ * @return {string}
452
+ */
453
+ i: function () {
454
+ return _lpad(vDate.getMinutes(), 2);
455
+ },
456
+ /**
457
+ * Seconds w/leading 0: `00..59`
458
+ * @return {string}
459
+ */
460
+ s: function () {
461
+ return _lpad(vDate.getSeconds(), 2);
462
+ },
463
+ /**
464
+ * Microseconds: `000000-999000`
465
+ * @return {string}
466
+ */
467
+ u: function () {
468
+ return _lpad(vDate.getMilliseconds() * 1000, 6);
469
+ },
470
+
471
+ //////////////
472
+ // TIMEZONE //
473
+ //////////////
474
+ /**
475
+ * Timezone identifier: `e.g. Atlantic/Azores, ...`
476
+ * @return {string}
477
+ */
478
+ e: function () {
479
+ var str = /\((.*)\)/.exec(String(vDate))[1];
480
+ return str || 'Coordinated Universal Time';
481
+ },
482
+ /**
483
+ * Timezone abbreviation: `e.g. EST, MDT, ...`
484
+ * @return {string}
485
+ */
486
+ T: function () {
487
+ var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
488
+ return str || 'UTC';
489
+ },
490
+ /**
491
+ * DST observed? `0 or 1`
492
+ * @return {number}
493
+ */
494
+ I: function () {
495
+ var a = new Date(fmt.Y(), 0), c = Date.UTC(fmt.Y(), 0),
496
+ b = new Date(fmt.Y(), 6), d = Date.UTC(fmt.Y(), 6);
497
+ return ((a - c) !== (b - d)) ? 1 : 0;
498
+ },
499
+ /**
500
+ * Difference to GMT in hour format: `e.g. +0200`
501
+ * @return {string}
502
+ */
503
+ O: function () {
504
+ var tzo = vDate.getTimezoneOffset(), a = Math.abs(tzo);
505
+ return (tzo > 0 ? '-' : '+') + _lpad(Math.floor(a / 60) * 100 + a % 60, 4);
506
+ },
507
+ /**
508
+ * Difference to GMT with colon: `e.g. +02:00`
509
+ * @return {string}
510
+ */
511
+ P: function () {
512
+ var O = fmt.O();
513
+ return (O.substr(0, 3) + ':' + O.substr(3, 2));
514
+ },
515
+ /**
516
+ * Timezone offset in seconds: `-43200...50400`
517
+ * @return {number}
518
+ */
519
+ Z: function () {
520
+ return -vDate.getTimezoneOffset() * 60;
521
+ },
522
+
523
+ ////////////////////
524
+ // FULL DATE TIME //
525
+ ////////////////////
526
+ /**
527
+ * ISO-8601 date
528
+ * @return {string}
529
+ */
530
+ c: function () {
531
+ return 'Y-m-d\\TH:i:sP'.replace(backspace, doFormat);
532
+ },
533
+ /**
534
+ * RFC 2822 date
535
+ * @return {string}
536
+ */
537
+ r: function () {
538
+ return 'D, d M Y H:i:s O'.replace(backspace, doFormat);
539
+ },
540
+ /**
541
+ * Seconds since UNIX epoch
542
+ * @return {number}
543
+ */
544
+ U: function () {
545
+ return vDate.getTime() / 1000 || 0;
546
+ }
547
+ };
548
+ return doFormat(vChar, vChar);
549
+ },
550
+ formatDate: function (vDate, vFormat) {
551
+ var self = this, i, n, len, str, vChar, vDateStr = '';
552
+ if (typeof vDate === 'string') {
553
+ vDate = self.parseDate(vDate, vFormat);
554
+ if (vDate === false) {
555
+ return false;
556
+ }
557
+ }
558
+ if (vDate instanceof Date) {
559
+ len = vFormat.length;
560
+ for (i = 0; i < len; i++) {
561
+ vChar = vFormat.charAt(i);
562
+ if (vChar === 'S') {
563
+ continue;
564
+ }
565
+ str = self.parseFormat(vChar, vDate);
566
+ if (i !== (len - 1) && self.intParts.test(vChar) && vFormat.charAt(i + 1) === 'S') {
567
+ n = parseInt(str);
568
+ str += self.dateSettings.ordinal(n);
569
+ }
570
+ vDateStr += str;
571
+ }
572
+ return vDateStr;
573
+ }
574
+ return '';
575
+ }
576
+ };
577
+ })();/**
578
+ * @preserve jQuery DateTimePicker plugin v2.4.7
579
+ * @homepage http://xdsoft.net/jqplugins/datetimepicker/
580
+ * @author Chupurnov Valeriy (<chupurnov@gmail.com>)
581
+ */
582
+ /*global DateFormatter, document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
583
+ ;(function (factory) {
584
+ if ( typeof define === 'function' && define.amd ) {
585
+ // AMD. Register as an anonymous module.
586
+ define(['jquery', 'jquery-mousewheel', 'date-functions'], factory);
587
+ } else if (typeof exports === 'object') {
588
+ // Node/CommonJS style for Browserify
589
+ module.exports = factory;
590
+ } else {
591
+ // Browser globals
592
+ factory(jQuery);
593
+ }
594
+ }(function ($) {
595
+ 'use strict';
596
+ var default_options = {
597
+ i18n: {
598
+ ar: { // Arabic
599
+ months: [
600
+ "كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
601
+ ],
602
+ dayOfWeekShort: [
603
+ "ن", "ث", "ع", "خ", "ج", "س", "ح"
604
+ ],
605
+ dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"]
606
+ },
607
+ ro: { // Romanian
608
+ months: [
609
+ "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
610
+ ],
611
+ dayOfWeekShort: [
612
+ "Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ"
613
+ ],
614
+ dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"]
615
+ },
616
+ id: { // Indonesian
617
+ months: [
618
+ "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
619
+ ],
620
+ dayOfWeekShort: [
621
+ "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
622
+ ],
623
+ dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
624
+ },
625
+ is: { // Icelandic
626
+ months: [
627
+ "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
628
+ ],
629
+ dayOfWeekShort: [
630
+ "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
631
+ ],
632
+ dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
633
+ },
634
+ bg: { // Bulgarian
635
+ months: [
636
+ "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
637
+ ],
638
+ dayOfWeekShort: [
639
+ "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
640
+ ],
641
+ dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"]
642
+ },
643
+ fa: { // Persian/Farsi
644
+ months: [
645
+ 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
646
+ ],
647
+ dayOfWeekShort: [
648
+ 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
649
+ ],
650
+ dayOfWeek: ["یک‌شنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", "پنج‌شنبه", "جمعه", "شنبه", "یک‌شنبه"]
651
+ },
652
+ ru: { // Russian
653
+ months: [
654
+ 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
655
+ ],
656
+ dayOfWeekShort: [
657
+ "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
658
+ ],
659
+ dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"]
660
+ },
661
+ uk: { // Ukrainian
662
+ months: [
663
+ 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
664
+ ],
665
+ dayOfWeekShort: [
666
+ "Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
667
+ ],
668
+ dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
669
+ },
670
+ en: { // English
671
+ months: [
672
+ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
673
+ ],
674
+ dayOfWeekShort: [
675
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
676
+ ],
677
+ dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
678
+ },
679
+ el: { // Ελληνικά
680
+ months: [
681
+ "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
682
+ ],
683
+ dayOfWeekShort: [
684
+ "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
685
+ ],
686
+ dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"]
687
+ },
688
+ de: { // German
689
+ months: [
690
+ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
691
+ ],
692
+ dayOfWeekShort: [
693
+ "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
694
+ ],
695
+ dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
696
+ },
697
+ nl: { // Dutch
698
+ months: [
699
+ "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
700
+ ],
701
+ dayOfWeekShort: [
702
+ "zo", "ma", "di", "wo", "do", "vr", "za"
703
+ ],
704
+ dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
705
+ },
706
+ tr: { // Turkish
707
+ months: [
708
+ "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
709
+ ],
710
+ dayOfWeekShort: [
711
+ "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
712
+ ],
713
+ dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
714
+ },
715
+ fr: { //French
716
+ months: [
717
+ "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
718
+ ],
719
+ dayOfWeekShort: [
720
+ "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
721
+ ],
722
+ dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
723
+ },
724
+ es: { // Spanish
725
+ months: [
726
+ "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
727
+ ],
728
+ dayOfWeekShort: [
729
+ "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
730
+ ],
731
+ dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
732
+ },
733
+ th: { // Thai
734
+ months: [
735
+ 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
736
+ ],
737
+ dayOfWeekShort: [
738
+ 'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
739
+ ],
740
+ dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"]
741
+ },
742
+ pl: { // Polish
743
+ months: [
744
+ "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
745
+ ],
746
+ dayOfWeekShort: [
747
+ "nd", "pn", "wt", "śr", "cz", "pt", "sb"
748
+ ],
749
+ dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"]
750
+ },
751
+ pt: { // Portuguese
752
+ months: [
753
+ "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
754
+ ],
755
+ dayOfWeekShort: [
756
+ "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
757
+ ],
758
+ dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
759
+ },
760
+ ch: { // Simplified Chinese
761
+ months: [
762
+ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
763
+ ],
764
+ dayOfWeekShort: [
765
+ "日", "一", "二", "三", "四", "五", "六"
766
+ ]
767
+ },
768
+ se: { // Swedish
769
+ months: [
770
+ "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
771
+ ],
772
+ dayOfWeekShort: [
773
+ "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
774
+ ]
775
+ },
776
+ kr: { // Korean
777
+ months: [
778
+ "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
779
+ ],
780
+ dayOfWeekShort: [
781
+ "일", "월", "화", "수", "목", "금", "토"
782
+ ],
783
+ dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
784
+ },
785
+ it: { // Italian
786
+ months: [
787
+ "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
788
+ ],
789
+ dayOfWeekShort: [
790
+ "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
791
+ ],
792
+ dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"]
793
+ },
794
+ da: { // Dansk
795
+ months: [
796
+ "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
797
+ ],
798
+ dayOfWeekShort: [
799
+ "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
800
+ ],
801
+ dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"]
802
+ },
803
+ no: { // Norwegian
804
+ months: [
805
+ "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
806
+ ],
807
+ dayOfWeekShort: [
808
+ "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
809
+ ],
810
+ dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
811
+ },
812
+ ja: { // Japanese
813
+ months: [
814
+ "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
815
+ ],
816
+ dayOfWeekShort: [
817
+ "日", "月", "火", "水", "木", "金", "土"
818
+ ],
819
+ dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"]
820
+ },
821
+ vi: { // Vietnamese
822
+ months: [
823
+ "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"
824
+ ],
825
+ dayOfWeekShort: [
826
+ "CN", "T2", "T3", "T4", "T5", "T6", "T7"
827
+ ],
828
+ dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"]
829
+ },
830
+ sl: { // Slovenščina
831
+ months: [
832
+ "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
833
+ ],
834
+ dayOfWeekShort: [
835
+ "Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
836
+ ],
837
+ dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"]
838
+ },
839
+ cs: { // Čeština
840
+ months: [
841
+ "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
842
+ ],
843
+ dayOfWeekShort: [
844
+ "Ne", "Po", "Út", "St", "Čt", "Pá", "So"
845
+ ]
846
+ },
847
+ hu: { // Hungarian
848
+ months: [
849
+ "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
850
+ ],
851
+ dayOfWeekShort: [
852
+ "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
853
+ ],
854
+ dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
855
+ },
856
+ az: { //Azerbaijanian (Azeri)
857
+ months: [
858
+ "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
859
+ ],
860
+ dayOfWeekShort: [
861
+ "B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
862
+ ],
863
+ dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"]
864
+ },
865
+ bs: { //Bosanski
866
+ months: [
867
+ "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
868
+ ],
869
+ dayOfWeekShort: [
870
+ "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
871
+ ],
872
+ dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
873
+ },
874
+ ca: { //Català
875
+ months: [
876
+ "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
877
+ ],
878
+ dayOfWeekShort: [
879
+ "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
880
+ ],
881
+ dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
882
+ },
883
+ 'en-GB': { //English (British)
884
+ months: [
885
+ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
886
+ ],
887
+ dayOfWeekShort: [
888
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
889
+ ],
890
+ dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
891
+ },
892
+ et: { //"Eesti"
893
+ months: [
894
+ "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
895
+ ],
896
+ dayOfWeekShort: [
897
+ "P", "E", "T", "K", "N", "R", "L"
898
+ ],
899
+ dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"]
900
+ },
901
+ eu: { //Euskara
902
+ months: [
903
+ "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
904
+ ],
905
+ dayOfWeekShort: [
906
+ "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
907
+ ],
908
+ dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
909
+ },
910
+ fi: { //Finnish (Suomi)
911
+ months: [
912
+ "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
913
+ ],
914
+ dayOfWeekShort: [
915
+ "Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
916
+ ],
917
+ dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
918
+ },
919
+ gl: { //Galego
920
+ months: [
921
+ "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
922
+ ],
923
+ dayOfWeekShort: [
924
+ "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
925
+ ],
926
+ dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"]
927
+ },
928
+ hr: { //Hrvatski
929
+ months: [
930
+ "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
931
+ ],
932
+ dayOfWeekShort: [
933
+ "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
934
+ ],
935
+ dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
936
+ },
937
+ ko: { //Korean (한국어)
938
+ months: [
939
+ "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
940
+ ],
941
+ dayOfWeekShort: [
942
+ "일", "월", "화", "수", "목", "금", "토"
943
+ ],
944
+ dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
945
+ },
946
+ lt: { //Lithuanian (lietuvių)
947
+ months: [
948
+ "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
949
+ ],
950
+ dayOfWeekShort: [
951
+ "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
952
+ ],
953
+ dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"]
954
+ },
955
+ lv: { //Latvian (Latviešu)
956
+ months: [
957
+ "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
958
+ ],
959
+ dayOfWeekShort: [
960
+ "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
961
+ ],
962
+ dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
963
+ },
964
+ mk: { //Macedonian (Македонски)
965
+ months: [
966
+ "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
967
+ ],
968
+ dayOfWeekShort: [
969
+ "нед", "пон", "вто", "сре", "чет", "пет", "саб"
970
+ ],
971
+ dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"]
972
+ },
973
+ mn: { //Mongolian (Монгол)
974
+ months: [
975
+ "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
976
+ ],
977
+ dayOfWeekShort: [
978
+ "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
979
+ ],
980
+ dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"]
981
+ },
982
+ 'pt-BR': { //Português(Brasil)
983
+ months: [
984
+ "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
985
+ ],
986
+ dayOfWeekShort: [
987
+ "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
988
+ ],
989
+ dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
990
+ },
991
+ sk: { //Slovenčina
992
+ months: [
993
+ "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
994
+ ],
995
+ dayOfWeekShort: [
996
+ "Ne", "Po", "Ut", "St", "Št", "Pi", "So"
997
+ ],
998
+ dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"]
999
+ },
1000
+ sq: { //Albanian (Shqip)
1001
+ months: [
1002
+ "Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"
1003
+ ],
1004
+ dayOfWeekShort: [
1005
+ "Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu"
1006
+ ],
1007
+ dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"]
1008
+ },
1009
+ 'sr-YU': { //Serbian (Srpski)
1010
+ months: [
1011
+ "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
1012
+ ],
1013
+ dayOfWeekShort: [
1014
+ "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
1015
+ ],
1016
+ dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"]
1017
+ },
1018
+ sr: { //Serbian Cyrillic (Српски)
1019
+ months: [
1020
+ "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
1021
+ ],
1022
+ dayOfWeekShort: [
1023
+ "нед", "пон", "уто", "сре", "чет", "пет", "суб"
1024
+ ],
1025
+ dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"]
1026
+ },
1027
+ sv: { //Svenska
1028
+ months: [
1029
+ "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
1030
+ ],
1031
+ dayOfWeekShort: [
1032
+ "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
1033
+ ],
1034
+ dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"]
1035
+ },
1036
+ 'zh-TW': { //Traditional Chinese (繁體中文)
1037
+ months: [
1038
+ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
1039
+ ],
1040
+ dayOfWeekShort: [
1041
+ "日", "一", "二", "三", "四", "五", "六"
1042
+ ],
1043
+ dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
1044
+ },
1045
+ zh: { //Simplified Chinese (简体中文)
1046
+ months: [
1047
+ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
1048
+ ],
1049
+ dayOfWeekShort: [
1050
+ "日", "一", "二", "三", "四", "五", "六"
1051
+ ],
1052
+ dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
1053
+ },
1054
+ he: { //Hebrew (עברית)
1055
+ months: [
1056
+ 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
1057
+ ],
1058
+ dayOfWeekShort: [
1059
+ 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
1060
+ ],
1061
+ dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"]
1062
+ },
1063
+ hy: { // Armenian
1064
+ months: [
1065
+ "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
1066
+ ],
1067
+ dayOfWeekShort: [
1068
+ "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
1069
+ ],
1070
+ dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"]
1071
+ },
1072
+ kg: { // Kyrgyz
1073
+ months: [
1074
+ 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
1075
+ ],
1076
+ dayOfWeekShort: [
1077
+ "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
1078
+ ],
1079
+ dayOfWeek: [
1080
+ "Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб"
1081
+ ]
1082
+ },
1083
+ rm: { // Romansh
1084
+ months: [
1085
+ "Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December"
1086
+ ],
1087
+ dayOfWeekShort: [
1088
+ "Du", "Gli", "Ma", "Me", "Gie", "Ve", "So"
1089
+ ],
1090
+ dayOfWeek: [
1091
+ "Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda"
1092
+ ]
1093
+ },
1094
+ },
1095
+ value: '',
1096
+ rtl: false,
1097
+
1098
+ format: 'Y/m/d H:i',
1099
+ formatTime: 'H:i',
1100
+ formatDate: 'Y/m/d',
1101
+
1102
+ startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
1103
+ step: 60,
1104
+ monthChangeSpinner: true,
1105
+
1106
+ closeOnDateSelect: false,
1107
+ closeOnTimeSelect: true,
1108
+ closeOnWithoutClick: true,
1109
+ closeOnInputClick: true,
1110
+
1111
+ timepicker: true,
1112
+ datepicker: true,
1113
+ weeks: false,
1114
+
1115
+ defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
1116
+ defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
1117
+
1118
+ minDate: false,
1119
+ maxDate: false,
1120
+ minTime: false,
1121
+ maxTime: false,
1122
+ disabledMinTime: false,
1123
+ disabledMaxTime: false,
1124
+
1125
+ allowTimes: [],
1126
+ opened: false,
1127
+ initTime: true,
1128
+ inline: false,
1129
+ theme: '',
1130
+
1131
+ onSelectDate: function () {},
1132
+ onSelectTime: function () {},
1133
+ onChangeMonth: function () {},
1134
+ onGetWeekOfYear: function () {},
1135
+ onChangeYear: function () {},
1136
+ onChangeDateTime: function () {},
1137
+ onShow: function () {},
1138
+ onClose: function () {},
1139
+ onGenerate: function () {},
1140
+
1141
+ withoutCopyright: true,
1142
+ inverseButton: false,
1143
+ hours12: false,
1144
+ next: 'xdsoft_next',
1145
+ prev : 'xdsoft_prev',
1146
+ dayOfWeekStart: 0,
1147
+ parentID: 'body',
1148
+ timeHeightInTimePicker: 25,
1149
+ timepickerScrollbar: true,
1150
+ todayButton: true,
1151
+ prevButton: true,
1152
+ nextButton: true,
1153
+ defaultSelect: true,
1154
+
1155
+ scrollMonth: true,
1156
+ scrollTime: true,
1157
+ scrollInput: true,
1158
+
1159
+ lazyInit: false,
1160
+ mask: false,
1161
+ validateOnBlur: true,
1162
+ allowBlank: true,
1163
+ yearStart: 1950,
1164
+ yearEnd: 2050,
1165
+ monthStart: 0,
1166
+ monthEnd: 11,
1167
+ style: '',
1168
+ id: '',
1169
+ fixed: false,
1170
+ roundTime: 'round', // ceil, floor
1171
+ className: '',
1172
+ weekends: [],
1173
+ highlightedDates: [],
1174
+ highlightedPeriods: [],
1175
+ allowDates : [],
1176
+ allowDateRe : null,
1177
+ disabledDates : [],
1178
+ disabledWeekDays: [],
1179
+ yearOffset: 0,
1180
+ beforeShowDay: null,
1181
+
1182
+ enterLikeTab: true,
1183
+ showApplyButton: false
1184
+ };
1185
+
1186
+ var dateHelper = null,
1187
+ globalLocaleDefault = 'en',
1188
+ globalLocale = 'en';
1189
+
1190
+ var dateFormatterOptionsDefault = {
1191
+ meridiem: ['AM', 'PM']
1192
+ };
1193
+
1194
+ var initDateFormatter = function(){
1195
+ var locale = default_options.i18n[globalLocale],
1196
+ opts = {
1197
+ days: locale.dayOfWeek,
1198
+ daysShort: locale.dayOfWeekShort,
1199
+ months: locale.months,
1200
+ monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }),
1201
+ };
1202
+
1203
+ dateHelper = new DateFormatter({
1204
+ dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
1205
+ });
1206
+ };
1207
+
1208
+ // for locale settings
1209
+ $.datetimepicker = {
1210
+ setLocale: function(locale){
1211
+ var newLocale = default_options.i18n[locale]?locale:globalLocaleDefault;
1212
+ if(globalLocale != newLocale){
1213
+ globalLocale = newLocale;
1214
+ // reinit date formatter
1215
+ initDateFormatter();
1216
+ }
1217
+ },
1218
+ RFC_2822: 'D, d M Y H:i:s O',
1219
+ ATOM: 'Y-m-d\TH:i:sP',
1220
+ ISO_8601: 'Y-m-d\TH:i:sO',
1221
+ RFC_822: 'D, d M y H:i:s O',
1222
+ RFC_850: 'l, d-M-y H:i:s T',
1223
+ RFC_1036: 'D, d M y H:i:s O',
1224
+ RFC_1123: 'D, d M Y H:i:s O',
1225
+ RSS: 'D, d M Y H:i:s O',
1226
+ W3C: 'Y-m-d\TH:i:sP'
1227
+ };
1228
+
1229
+ // first init date formatter
1230
+ initDateFormatter();
1231
+
1232
+ // fix for ie8
1233
+ if (!window.getComputedStyle) {
1234
+ window.getComputedStyle = function (el, pseudo) {
1235
+ this.el = el;
1236
+ this.getPropertyValue = function (prop) {
1237
+ var re = /(\-([a-z]){1})/g;
1238
+ if (prop === 'float') {
1239
+ prop = 'styleFloat';
1240
+ }
1241
+ if (re.test(prop)) {
1242
+ prop = prop.replace(re, function (a, b, c) {
1243
+ return c.toUpperCase();
1244
+ });
1245
+ }
1246
+ return el.currentStyle[prop] || null;
1247
+ };
1248
+ return this;
1249
+ };
1250
+ }
1251
+ if (!Array.prototype.indexOf) {
1252
+ Array.prototype.indexOf = function (obj, start) {
1253
+ var i, j;
1254
+ for (i = (start || 0), j = this.length; i < j; i += 1) {
1255
+ if (this[i] === obj) { return i; }
1256
+ }
1257
+ return -1;
1258
+ };
1259
+ }
1260
+ Date.prototype.countDaysInMonth = function () {
1261
+ return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
1262
+ };
1263
+ $.fn.xdsoftScroller = function (percent) {
1264
+ return this.each(function () {
1265
+ var timeboxparent = $(this),
1266
+ pointerEventToXY = function (e) {
1267
+ var out = {x: 0, y: 0},
1268
+ touch;
1269
+ if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
1270
+ touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
1271
+ out.x = touch.clientX;
1272
+ out.y = touch.clientY;
1273
+ } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
1274
+ out.x = e.clientX;
1275
+ out.y = e.clientY;
1276
+ }
1277
+ return out;
1278
+ },
1279
+ move = 0,
1280
+ timebox,
1281
+ parentHeight,
1282
+ height,
1283
+ scrollbar,
1284
+ scroller,
1285
+ maximumOffset = 100,
1286
+ start = false,
1287
+ startY = 0,
1288
+ startTop = 0,
1289
+ h1 = 0,
1290
+ touchStart = false,
1291
+ startTopScroll = 0,
1292
+ calcOffset = function () {};
1293
+ if (percent === 'hide') {
1294
+ timeboxparent.find('.xdsoft_scrollbar').hide();
1295
+ return;
1296
+ }
1297
+ if (!$(this).hasClass('xdsoft_scroller_box')) {
1298
+ timebox = timeboxparent.children().eq(0);
1299
+ parentHeight = timeboxparent[0].clientHeight;
1300
+ height = timebox[0].offsetHeight;
1301
+ scrollbar = $('<div class="xdsoft_scrollbar"></div>');
1302
+ scroller = $('<div class="xdsoft_scroller"></div>');
1303
+ scrollbar.append(scroller);
1304
+
1305
+ timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
1306
+ calcOffset = function calcOffset(event) {
1307
+ var offset = pointerEventToXY(event).y - startY + startTopScroll;
1308
+ if (offset < 0) {
1309
+ offset = 0;
1310
+ }
1311
+ if (offset + scroller[0].offsetHeight > h1) {
1312
+ offset = h1 - scroller[0].offsetHeight;
1313
+ }
1314
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
1315
+ };
1316
+
1317
+ scroller
1318
+ .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
1319
+ if (!parentHeight) {
1320
+ timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
1321
+ }
1322
+
1323
+ startY = pointerEventToXY(event).y;
1324
+ startTopScroll = parseInt(scroller.css('margin-top'), 10);
1325
+ h1 = scrollbar[0].offsetHeight;
1326
+
1327
+ if (event.type === 'mousedown' || event.type === 'touchstart') {
1328
+ if (document) {
1329
+ $(document.body).addClass('xdsoft_noselect');
1330
+ }
1331
+ $([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
1332
+ $([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
1333
+ .off('mousemove.xdsoft_scroller', calcOffset)
1334
+ .removeClass('xdsoft_noselect');
1335
+ });
1336
+ $(document.body).on('mousemove.xdsoft_scroller', calcOffset);
1337
+ } else {
1338
+ touchStart = true;
1339
+ event.stopPropagation();
1340
+ event.preventDefault();
1341
+ }
1342
+ })
1343
+ .on('touchmove', function (event) {
1344
+ if (touchStart) {
1345
+ event.preventDefault();
1346
+ calcOffset(event);
1347
+ }
1348
+ })
1349
+ .on('touchend touchcancel', function (event) {
1350
+ touchStart = false;
1351
+ startTopScroll = 0;
1352
+ });
1353
+
1354
+ timeboxparent
1355
+ .on('scroll_element.xdsoft_scroller', function (event, percentage) {
1356
+ if (!parentHeight) {
1357
+ timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
1358
+ }
1359
+ percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
1360
+
1361
+ scroller.css('margin-top', maximumOffset * percentage);
1362
+
1363
+ setTimeout(function () {
1364
+ timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
1365
+ }, 10);
1366
+ })
1367
+ .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
1368
+ var percent, sh;
1369
+ parentHeight = timeboxparent[0].clientHeight;
1370
+ height = timebox[0].offsetHeight;
1371
+ percent = parentHeight / height;
1372
+ sh = percent * scrollbar[0].offsetHeight;
1373
+ if (percent > 1) {
1374
+ scroller.hide();
1375
+ } else {
1376
+ scroller.show();
1377
+ scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
1378
+ maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
1379
+ if (noTriggerScroll !== true) {
1380
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
1381
+ }
1382
+ }
1383
+ });
1384
+
1385
+ timeboxparent.on('mousewheel', function (event) {
1386
+ var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
1387
+
1388
+ top = top - (event.deltaY * 20);
1389
+ if (top < 0) {
1390
+ top = 0;
1391
+ }
1392
+
1393
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
1394
+ event.stopPropagation();
1395
+ return false;
1396
+ });
1397
+
1398
+ timeboxparent.on('touchstart', function (event) {
1399
+ start = pointerEventToXY(event);
1400
+ startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
1401
+ });
1402
+
1403
+ timeboxparent.on('touchmove', function (event) {
1404
+ if (start) {
1405
+ event.preventDefault();
1406
+ var coord = pointerEventToXY(event);
1407
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
1408
+ }
1409
+ });
1410
+
1411
+ timeboxparent.on('touchend touchcancel', function (event) {
1412
+ start = false;
1413
+ startTop = 0;
1414
+ });
1415
+ }
1416
+ timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
1417
+ });
1418
+ };
1419
+
1420
+ $.fn.datetimepicker = function (opt) {
1421
+ var KEY0 = 48,
1422
+ KEY9 = 57,
1423
+ _KEY0 = 96,
1424
+ _KEY9 = 105,
1425
+ CTRLKEY = 17,
1426
+ DEL = 46,
1427
+ ENTER = 13,
1428
+ ESC = 27,
1429
+ BACKSPACE = 8,
1430
+ ARROWLEFT = 37,
1431
+ ARROWUP = 38,
1432
+ ARROWRIGHT = 39,
1433
+ ARROWDOWN = 40,
1434
+ TAB = 9,
1435
+ F5 = 116,
1436
+ AKEY = 65,
1437
+ CKEY = 67,
1438
+ VKEY = 86,
1439
+ ZKEY = 90,
1440
+ YKEY = 89,
1441
+ ctrlDown = false,
1442
+ options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
1443
+
1444
+ lazyInitTimer = 0,
1445
+ createDateTimePicker,
1446
+ destroyDateTimePicker,
1447
+
1448
+ lazyInit = function (input) {
1449
+ input
1450
+ .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback(event) {
1451
+ if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
1452
+ return;
1453
+ }
1454
+ clearTimeout(lazyInitTimer);
1455
+ lazyInitTimer = setTimeout(function () {
1456
+
1457
+ if (!input.data('xdsoft_datetimepicker')) {
1458
+ createDateTimePicker(input);
1459
+ }
1460
+ input
1461
+ .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
1462
+ .trigger('open.xdsoft');
1463
+ }, 100);
1464
+ });
1465
+ };
1466
+
1467
+ createDateTimePicker = function (input) {
1468
+ var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
1469
+ xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
1470
+ datepicker = $('<div class="xdsoft_datepicker active"></div>'),
1471
+ mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
1472
+ '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
1473
+ '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
1474
+ '<button type="button" class="xdsoft_next"></button></div>'),
1475
+ calendar = $('<div class="xdsoft_calendar"></div>'),
1476
+ timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),
1477
+ timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
1478
+ timebox = $('<div class="xdsoft_time_variant"></div>'),
1479
+ applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
1480
+ /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
1481
+ scroller = $('<div class="xdsoft_scroller"></div>'),*/
1482
+ monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
1483
+ yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
1484
+ triggerAfterOpen = false,
1485
+ XDSoft_datetime,
1486
+ //scroll_element,
1487
+ xchangeTimer,
1488
+ timerclick,
1489
+ current_time_index,
1490
+ setPos,
1491
+ timer = 0,
1492
+ timer1 = 0,
1493
+ _xdsoft_datetime;
1494
+
1495
+ if (options.id) {
1496
+ datetimepicker.attr('id', options.id);
1497
+ }
1498
+ if (options.style) {
1499
+ datetimepicker.attr('style', options.style);
1500
+ }
1501
+ if (options.weeks) {
1502
+ datetimepicker.addClass('xdsoft_showweeks');
1503
+ }
1504
+ if (options.rtl) {
1505
+ datetimepicker.addClass('xdsoft_rtl');
1506
+ }
1507
+
1508
+ datetimepicker.addClass('xdsoft_' + options.theme);
1509
+ datetimepicker.addClass(options.className);
1510
+
1511
+ mounth_picker
1512
+ .find('.xdsoft_month span')
1513
+ .after(monthselect);
1514
+ mounth_picker
1515
+ .find('.xdsoft_year span')
1516
+ .after(yearselect);
1517
+
1518
+ mounth_picker
1519
+ .find('.xdsoft_month,.xdsoft_year')
1520
+ .on('touchstart mousedown.xdsoft', function (event) {
1521
+ var select = $(this).find('.xdsoft_select').eq(0),
1522
+ val = 0,
1523
+ top = 0,
1524
+ visible = select.is(':visible'),
1525
+ items,
1526
+ i;
1527
+
1528
+ mounth_picker
1529
+ .find('.xdsoft_select')
1530
+ .hide();
1531
+ if (_xdsoft_datetime.currentTime) {
1532
+ val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
1533
+ }
1534
+
1535
+ select[visible ? 'hide' : 'show']();
1536
+ for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
1537
+ if (items.eq(i).data('value') === val) {
1538
+ break;
1539
+ } else {
1540
+ top += items[0].offsetHeight;
1541
+ }
1542
+ }
1543
+
1544
+ select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
1545
+ event.stopPropagation();
1546
+ return false;
1547
+ });
1548
+
1549
+ mounth_picker
1550
+ .find('.xdsoft_select')
1551
+ .xdsoftScroller()
1552
+ .on('touchstart mousedown.xdsoft', function (event) {
1553
+ event.stopPropagation();
1554
+ event.preventDefault();
1555
+ })
1556
+ .on('touchstart mousedown.xdsoft', '.xdsoft_option', function (event) {
1557
+ if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
1558
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1559
+ }
1560
+
1561
+ var year = _xdsoft_datetime.currentTime.getFullYear();
1562
+ if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
1563
+ _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
1564
+ }
1565
+
1566
+ $(this).parent().parent().hide();
1567
+
1568
+ datetimepicker.trigger('xchange.xdsoft');
1569
+ if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1570
+ options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1571
+ }
1572
+
1573
+ if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
1574
+ options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1575
+ }
1576
+ });
1577
+
1578
+ datetimepicker.setOptions = function (_options) {
1579
+ var highlightedDates = {},
1580
+ getCaretPos = function (input) {
1581
+ try {
1582
+ if (document.selection && document.selection.createRange) {
1583
+ var range = document.selection.createRange();
1584
+ return range.getBookmark().charCodeAt(2) - 2;
1585
+ }
1586
+ if (input.setSelectionRange) {
1587
+ return input.selectionStart;
1588
+ }
1589
+ } catch (e) {
1590
+ return 0;
1591
+ }
1592
+ },
1593
+ setCaretPos = function (node, pos) {
1594
+ node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
1595
+ if (!node) {
1596
+ return false;
1597
+ }
1598
+ if (node.createTextRange) {
1599
+ var textRange = node.createTextRange();
1600
+ textRange.collapse(true);
1601
+ textRange.moveEnd('character', pos);
1602
+ textRange.moveStart('character', pos);
1603
+ textRange.select();
1604
+ return true;
1605
+ }
1606
+ if (node.setSelectionRange) {
1607
+ node.setSelectionRange(pos, pos);
1608
+ return true;
1609
+ }
1610
+ return false;
1611
+ },
1612
+ isValidValue = function (mask, value) {
1613
+ var reg = mask
1614
+ .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
1615
+ .replace(/_/g, '{digit+}')
1616
+ .replace(/([0-9]{1})/g, '{digit$1}')
1617
+ .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
1618
+ .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
1619
+ return (new RegExp(reg)).test(value);
1620
+ };
1621
+ options = $.extend(true, {}, options, _options);
1622
+
1623
+ if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
1624
+ options.allowTimes = $.extend(true, [], _options.allowTimes);
1625
+ }
1626
+
1627
+ if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
1628
+ options.weekends = $.extend(true, [], _options.weekends);
1629
+ }
1630
+
1631
+ if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
1632
+ options.allowDates = $.extend(true, [], _options.allowDates);
1633
+ }
1634
+
1635
+ if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
1636
+ options.allowDateRe = new RegExp(_options.allowDateRe);
1637
+ }
1638
+
1639
+ if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
1640
+ $.each(_options.highlightedDates, function (index, value) {
1641
+ var splitData = $.map(value.split(','), $.trim),
1642
+ exDesc,
1643
+ hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
1644
+ keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
1645
+ if (highlightedDates[keyDate] !== undefined) {
1646
+ exDesc = highlightedDates[keyDate].desc;
1647
+ if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
1648
+ highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
1649
+ }
1650
+ } else {
1651
+ highlightedDates[keyDate] = hDate;
1652
+ }
1653
+ });
1654
+
1655
+ options.highlightedDates = $.extend(true, [], highlightedDates);
1656
+ }
1657
+
1658
+ if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
1659
+ highlightedDates = $.extend(true, [], options.highlightedDates);
1660
+ $.each(_options.highlightedPeriods, function (index, value) {
1661
+ var dateTest, // start date
1662
+ dateEnd,
1663
+ desc,
1664
+ hDate,
1665
+ keyDate,
1666
+ exDesc,
1667
+ style;
1668
+ if ($.isArray(value)) {
1669
+ dateTest = value[0];
1670
+ dateEnd = value[1];
1671
+ desc = value[2];
1672
+ style = value[3];
1673
+ }
1674
+ else {
1675
+ var splitData = $.map(value.split(','), $.trim);
1676
+ dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
1677
+ dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
1678
+ desc = splitData[2];
1679
+ style = splitData[3];
1680
+ }
1681
+
1682
+ while (dateTest <= dateEnd) {
1683
+ hDate = new HighlightedDate(dateTest, desc, style);
1684
+ keyDate = dateHelper.formatDate(dateTest, options.formatDate);
1685
+ dateTest.setDate(dateTest.getDate() + 1);
1686
+ if (highlightedDates[keyDate] !== undefined) {
1687
+ exDesc = highlightedDates[keyDate].desc;
1688
+ if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
1689
+ highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
1690
+ }
1691
+ } else {
1692
+ highlightedDates[keyDate] = hDate;
1693
+ }
1694
+ }
1695
+ });
1696
+
1697
+ options.highlightedDates = $.extend(true, [], highlightedDates);
1698
+ }
1699
+
1700
+ if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
1701
+ options.disabledDates = $.extend(true, [], _options.disabledDates);
1702
+ }
1703
+
1704
+ if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
1705
+ options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
1706
+ }
1707
+
1708
+ if ((options.open || options.opened) && (!options.inline)) {
1709
+ input.trigger('open.xdsoft');
1710
+ }
1711
+
1712
+ if (options.inline) {
1713
+ triggerAfterOpen = true;
1714
+ datetimepicker.addClass('xdsoft_inline');
1715
+ input.after(datetimepicker).hide();
1716
+ }
1717
+
1718
+ if (options.inverseButton) {
1719
+ options.next = 'xdsoft_prev';
1720
+ options.prev = 'xdsoft_next';
1721
+ }
1722
+
1723
+ if (options.datepicker) {
1724
+ datepicker.addClass('active');
1725
+ } else {
1726
+ datepicker.removeClass('active');
1727
+ }
1728
+
1729
+ if (options.timepicker) {
1730
+ timepicker.addClass('active');
1731
+ } else {
1732
+ timepicker.removeClass('active');
1733
+ }
1734
+
1735
+ if (options.value) {
1736
+ _xdsoft_datetime.setCurrentTime(options.value);
1737
+ if (input && input.val) {
1738
+ input.val(_xdsoft_datetime.str);
1739
+ }
1740
+ }
1741
+
1742
+ if (isNaN(options.dayOfWeekStart)) {
1743
+ options.dayOfWeekStart = 0;
1744
+ } else {
1745
+ options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
1746
+ }
1747
+
1748
+ if (!options.timepickerScrollbar) {
1749
+ timeboxparent.xdsoftScroller('hide');
1750
+ }
1751
+
1752
+ if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
1753
+ options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
1754
+ }
1755
+
1756
+ if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) {
1757
+ options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
1758
+ }
1759
+
1760
+ applyButton.toggle(options.showApplyButton);
1761
+
1762
+ mounth_picker
1763
+ .find('.xdsoft_today_button')
1764
+ .css('visibility', !options.todayButton ? 'hidden' : 'visible');
1765
+
1766
+ mounth_picker
1767
+ .find('.' + options.prev)
1768
+ .css('visibility', !options.prevButton ? 'hidden' : 'visible');
1769
+
1770
+ mounth_picker
1771
+ .find('.' + options.next)
1772
+ .css('visibility', !options.nextButton ? 'hidden' : 'visible');
1773
+
1774
+ if (options.mask) {
1775
+ input.off('keydown.xdsoft');
1776
+
1777
+ if (options.mask === true) {
1778
+ options.mask = options.format
1779
+ .replace(/Y/g, '9999')
1780
+ .replace(/F/g, '9999')
1781
+ .replace(/m/g, '19')
1782
+ .replace(/d/g, '39')
1783
+ .replace(/H/g, '29')
1784
+ .replace(/i/g, '59')
1785
+ .replace(/s/g, '59');
1786
+ }
1787
+
1788
+ if ($.type(options.mask) === 'string') {
1789
+ if (!isValidValue(options.mask, input.val())) {
1790
+ input.val(options.mask.replace(/[0-9]/g, '_'));
1791
+ setCaretPos(input[0], 0);
1792
+ }
1793
+
1794
+ input.on('keydown.xdsoft', function (event) {
1795
+ var val = this.value,
1796
+ key = event.which,
1797
+ pos,
1798
+ digit;
1799
+
1800
+ if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) {
1801
+ pos = getCaretPos(this);
1802
+ digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_';
1803
+
1804
+ if ((key === BACKSPACE || key === DEL) && pos) {
1805
+ pos -= 1;
1806
+ digit = '_';
1807
+ }
1808
+
1809
+ while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
1810
+ pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
1811
+ }
1812
+
1813
+ val = val.substr(0, pos) + digit + val.substr(pos + 1);
1814
+ if ($.trim(val) === '') {
1815
+ val = options.mask.replace(/[0-9]/g, '_');
1816
+ } else {
1817
+ if (pos === options.mask.length) {
1818
+ event.preventDefault();
1819
+ return false;
1820
+ }
1821
+ }
1822
+
1823
+ pos += (key === BACKSPACE || key === DEL) ? 0 : 1;
1824
+ while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
1825
+ pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
1826
+ }
1827
+
1828
+ if (isValidValue(options.mask, val)) {
1829
+ this.value = val;
1830
+ setCaretPos(this, pos);
1831
+ } else if ($.trim(val) === '') {
1832
+ this.value = options.mask.replace(/[0-9]/g, '_');
1833
+ } else {
1834
+ input.trigger('error_input.xdsoft');
1835
+ }
1836
+ } else {
1837
+ if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
1838
+ return true;
1839
+ }
1840
+ }
1841
+
1842
+ event.preventDefault();
1843
+ return false;
1844
+ });
1845
+ }
1846
+ }
1847
+ if (options.validateOnBlur) {
1848
+ input
1849
+ .off('blur.xdsoft')
1850
+ .on('blur.xdsoft', function () {
1851
+ if (options.allowBlank && !$.trim($(this).val()).length) {
1852
+ $(this).val(null);
1853
+ datetimepicker.data('xdsoft_datetime').empty();
1854
+ } else if (!dateHelper.parseDate($(this).val(), options.format)) {
1855
+ var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
1856
+ splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
1857
+
1858
+ // parse the numbers as 0312 => 03:12
1859
+ if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
1860
+ $(this).val([splittedHours, splittedMinutes].map(function (item) {
1861
+ return item > 9 ? item : '0' + item;
1862
+ }).join(':'));
1863
+ } else {
1864
+ $(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
1865
+ }
1866
+
1867
+ datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1868
+ } else {
1869
+ datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1870
+ }
1871
+
1872
+ datetimepicker.trigger('changedatetime.xdsoft');
1873
+ });
1874
+ }
1875
+ options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
1876
+
1877
+ datetimepicker
1878
+ .trigger('xchange.xdsoft')
1879
+ .trigger('afterOpen.xdsoft');
1880
+ };
1881
+
1882
+ datetimepicker
1883
+ .data('options', options)
1884
+ .on('touchstart mousedown.xdsoft', function (event) {
1885
+ event.stopPropagation();
1886
+ event.preventDefault();
1887
+ yearselect.hide();
1888
+ monthselect.hide();
1889
+ return false;
1890
+ });
1891
+
1892
+ //scroll_element = timepicker.find('.xdsoft_time_box');
1893
+ timeboxparent.append(timebox);
1894
+ timeboxparent.xdsoftScroller();
1895
+
1896
+ datetimepicker.on('afterOpen.xdsoft', function () {
1897
+ timeboxparent.xdsoftScroller();
1898
+ });
1899
+
1900
+ datetimepicker
1901
+ .append(datepicker)
1902
+ .append(timepicker);
1903
+
1904
+ if (options.withoutCopyright !== true) {
1905
+ datetimepicker
1906
+ .append(xdsoft_copyright);
1907
+ }
1908
+
1909
+ datepicker
1910
+ .append(mounth_picker)
1911
+ .append(calendar)
1912
+ .append(applyButton);
1913
+
1914
+ $(options.parentID)
1915
+ .append(datetimepicker);
1916
+
1917
+ XDSoft_datetime = function () {
1918
+ var _this = this;
1919
+ _this.now = function (norecursion) {
1920
+ var d = new Date(),
1921
+ date,
1922
+ time;
1923
+
1924
+ if (!norecursion && options.defaultDate) {
1925
+ date = _this.strToDateTime(options.defaultDate);
1926
+ d.setFullYear(date.getFullYear());
1927
+ d.setMonth(date.getMonth());
1928
+ d.setDate(date.getDate());
1929
+ }
1930
+
1931
+ if (options.yearOffset) {
1932
+ d.setFullYear(d.getFullYear() + options.yearOffset);
1933
+ }
1934
+
1935
+ if (!norecursion && options.defaultTime) {
1936
+ time = _this.strtotime(options.defaultTime);
1937
+ d.setHours(time.getHours());
1938
+ d.setMinutes(time.getMinutes());
1939
+ }
1940
+ return d;
1941
+ };
1942
+
1943
+ _this.isValidDate = function (d) {
1944
+ if (Object.prototype.toString.call(d) !== "[object Date]") {
1945
+ return false;
1946
+ }
1947
+ return !isNaN(d.getTime());
1948
+ };
1949
+
1950
+ _this.setCurrentTime = function (dTime) {
1951
+ _this.currentTime = (typeof dTime === 'string') ? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime : _this.now();
1952
+ datetimepicker.trigger('xchange.xdsoft');
1953
+ };
1954
+
1955
+ _this.empty = function () {
1956
+ _this.currentTime = null;
1957
+ };
1958
+
1959
+ _this.getCurrentTime = function (dTime) {
1960
+ return _this.currentTime;
1961
+ };
1962
+
1963
+ _this.nextMonth = function () {
1964
+
1965
+ if (_this.currentTime === undefined || _this.currentTime === null) {
1966
+ _this.currentTime = _this.now();
1967
+ }
1968
+
1969
+ var month = _this.currentTime.getMonth() + 1,
1970
+ year;
1971
+ if (month === 12) {
1972
+ _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
1973
+ month = 0;
1974
+ }
1975
+
1976
+ year = _this.currentTime.getFullYear();
1977
+
1978
+ _this.currentTime.setDate(
1979
+ Math.min(
1980
+ new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
1981
+ _this.currentTime.getDate()
1982
+ )
1983
+ );
1984
+ _this.currentTime.setMonth(month);
1985
+
1986
+ if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1987
+ options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1988
+ }
1989
+
1990
+ if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
1991
+ options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1992
+ }
1993
+
1994
+ datetimepicker.trigger('xchange.xdsoft');
1995
+ return month;
1996
+ };
1997
+
1998
+ _this.prevMonth = function () {
1999
+
2000
+ if (_this.currentTime === undefined || _this.currentTime === null) {
2001
+ _this.currentTime = _this.now();
2002
+ }
2003
+
2004
+ var month = _this.currentTime.getMonth() - 1;
2005
+ if (month === -1) {
2006
+ _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
2007
+ month = 11;
2008
+ }
2009
+ _this.currentTime.setDate(
2010
+ Math.min(
2011
+ new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
2012
+ _this.currentTime.getDate()
2013
+ )
2014
+ );
2015
+ _this.currentTime.setMonth(month);
2016
+ if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
2017
+ options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
2018
+ }
2019
+ datetimepicker.trigger('xchange.xdsoft');
2020
+ return month;
2021
+ };
2022
+
2023
+ _this.getWeekOfYear = function (datetime) {
2024
+ if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) {
2025
+ var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
2026
+ if (typeof week !== 'undefined') {
2027
+ return week;
2028
+ }
2029
+ }
2030
+ var onejan = new Date(datetime.getFullYear(), 0, 1);
2031
+ //First week of the year is th one with the first Thursday according to ISO8601
2032
+ if(onejan.getDay()!=4)
2033
+ onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
2034
+ return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
2035
+ };
2036
+
2037
+ _this.strToDateTime = function (sDateTime) {
2038
+ var tmpDate = [], timeOffset, currentTime;
2039
+
2040
+ if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
2041
+ return sDateTime;
2042
+ }
2043
+
2044
+ tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime);
2045
+ if (tmpDate) {
2046
+ tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
2047
+ }
2048
+ if (tmpDate && tmpDate[2]) {
2049
+ timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
2050
+ currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
2051
+ } else {
2052
+ currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
2053
+ }
2054
+
2055
+ if (!_this.isValidDate(currentTime)) {
2056
+ currentTime = _this.now();
2057
+ }
2058
+
2059
+ return currentTime;
2060
+ };
2061
+
2062
+ _this.strToDate = function (sDate) {
2063
+ if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
2064
+ return sDate;
2065
+ }
2066
+
2067
+ var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
2068
+ if (!_this.isValidDate(currentTime)) {
2069
+ currentTime = _this.now(true);
2070
+ }
2071
+ return currentTime;
2072
+ };
2073
+
2074
+ _this.strtotime = function (sTime) {
2075
+ if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
2076
+ return sTime;
2077
+ }
2078
+ var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
2079
+ if (!_this.isValidDate(currentTime)) {
2080
+ currentTime = _this.now(true);
2081
+ }
2082
+ return currentTime;
2083
+ };
2084
+
2085
+ _this.str = function () {
2086
+ return dateHelper.formatDate(_this.currentTime, options.format);
2087
+ };
2088
+ _this.currentTime = this.now();
2089
+ };
2090
+
2091
+ _xdsoft_datetime = new XDSoft_datetime();
2092
+
2093
+ applyButton.on('touchend click', function (e) {//pathbrite
2094
+ e.preventDefault();
2095
+ datetimepicker.data('changed', true);
2096
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
2097
+ input.val(_xdsoft_datetime.str());
2098
+ datetimepicker.trigger('close.xdsoft');
2099
+ });
2100
+ mounth_picker
2101
+ .find('.xdsoft_today_button')
2102
+ .on('touchend mousedown.xdsoft', function () {
2103
+ datetimepicker.data('changed', true);
2104
+ _xdsoft_datetime.setCurrentTime(0);
2105
+ datetimepicker.trigger('afterOpen.xdsoft');
2106
+ }).on('dblclick.xdsoft', function () {
2107
+ var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
2108
+ currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
2109
+ minDate = _xdsoft_datetime.strToDate(options.minDate);
2110
+ minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
2111
+ if (currentDate < minDate) {
2112
+ return;
2113
+ }
2114
+ maxDate = _xdsoft_datetime.strToDate(options.maxDate);
2115
+ maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
2116
+ if (currentDate > maxDate) {
2117
+ return;
2118
+ }
2119
+ input.val(_xdsoft_datetime.str());
2120
+ input.trigger('change');
2121
+ datetimepicker.trigger('close.xdsoft');
2122
+ });
2123
+ mounth_picker
2124
+ .find('.xdsoft_prev,.xdsoft_next')
2125
+ .on('touchend mousedown.xdsoft', function () {
2126
+ var $this = $(this),
2127
+ timer = 0,
2128
+ stop = false;
2129
+
2130
+ (function arguments_callee1(v) {
2131
+ if ($this.hasClass(options.next)) {
2132
+ _xdsoft_datetime.nextMonth();
2133
+ } else if ($this.hasClass(options.prev)) {
2134
+ _xdsoft_datetime.prevMonth();
2135
+ }
2136
+ if (options.monthChangeSpinner) {
2137
+ if (!stop) {
2138
+ timer = setTimeout(arguments_callee1, v || 100);
2139
+ }
2140
+ }
2141
+ }(500));
2142
+
2143
+ $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() {
2144
+ clearTimeout(timer);
2145
+ stop = true;
2146
+ $([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2);
2147
+ });
2148
+ });
2149
+
2150
+ timepicker
2151
+ .find('.xdsoft_prev,.xdsoft_next')
2152
+ .on('touchend mousedown.xdsoft', function () {
2153
+ var $this = $(this),
2154
+ timer = 0,
2155
+ stop = false,
2156
+ period = 110;
2157
+ (function arguments_callee4(v) {
2158
+ var pheight = timeboxparent[0].clientHeight,
2159
+ height = timebox[0].offsetHeight,
2160
+ top = Math.abs(parseInt(timebox.css('marginTop'), 10));
2161
+ if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
2162
+ timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
2163
+ } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
2164
+ timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
2165
+ }
2166
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]);
2167
+ period = (period > 10) ? 10 : period - 10;
2168
+ if (!stop) {
2169
+ timer = setTimeout(arguments_callee4, v || period);
2170
+ }
2171
+ }(500));
2172
+ $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() {
2173
+ clearTimeout(timer);
2174
+ stop = true;
2175
+ $([document.body, window])
2176
+ .off('touchend mouseup.xdsoft', arguments_callee5);
2177
+ });
2178
+ });
2179
+
2180
+ xchangeTimer = 0;
2181
+ // base handler - generating a calendar and timepicker
2182
+ datetimepicker
2183
+ .on('xchange.xdsoft', function (event) {
2184
+ clearTimeout(xchangeTimer);
2185
+ xchangeTimer = setTimeout(function () {
2186
+
2187
+ if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
2188
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
2189
+ }
2190
+
2191
+ var table = '',
2192
+ start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
2193
+ i = 0,
2194
+ j,
2195
+ today = _xdsoft_datetime.now(),
2196
+ maxDate = false,
2197
+ minDate = false,
2198
+ hDate,
2199
+ day,
2200
+ d,
2201
+ y,
2202
+ m,
2203
+ w,
2204
+ classes = [],
2205
+ customDateSettings,
2206
+ newRow = true,
2207
+ time = '',
2208
+ h = '',
2209
+ line_time,
2210
+ description;
2211
+
2212
+ while (start.getDay() !== options.dayOfWeekStart) {
2213
+ start.setDate(start.getDate() - 1);
2214
+ }
2215
+
2216
+ table += '<table><thead><tr>';
2217
+
2218
+ if (options.weeks) {
2219
+ table += '<th></th>';
2220
+ }
2221
+
2222
+ for (j = 0; j < 7; j += 1) {
2223
+ table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
2224
+ }
2225
+
2226
+ table += '</tr></thead>';
2227
+ table += '<tbody>';
2228
+
2229
+ if (options.maxDate !== false) {
2230
+ maxDate = _xdsoft_datetime.strToDate(options.maxDate);
2231
+ maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
2232
+ }
2233
+
2234
+ if (options.minDate !== false) {
2235
+ minDate = _xdsoft_datetime.strToDate(options.minDate);
2236
+ minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
2237
+ }
2238
+
2239
+ while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
2240
+ classes = [];
2241
+ i += 1;
2242
+
2243
+ day = start.getDay();
2244
+ d = start.getDate();
2245
+ y = start.getFullYear();
2246
+ m = start.getMonth();
2247
+ w = _xdsoft_datetime.getWeekOfYear(start);
2248
+ description = '';
2249
+
2250
+ classes.push('xdsoft_date');
2251
+
2252
+ if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
2253
+ customDateSettings = options.beforeShowDay.call(datetimepicker, start);
2254
+ } else {
2255
+ customDateSettings = null;
2256
+ }
2257
+
2258
+ if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
2259
+ if(!options.allowDateRe.test(start.dateFormat(options.formatDate))){
2260
+ classes.push('xdsoft_disabled');
2261
+ }
2262
+ } else if(options.allowDates && options.allowDates.length>0){
2263
+ if(options.allowDates.indexOf(start.dateFormat(options.formatDate)) === -1){
2264
+ classes.push('xdsoft_disabled');
2265
+ }
2266
+ } else if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
2267
+ classes.push('xdsoft_disabled');
2268
+ } else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
2269
+ classes.push('xdsoft_disabled');
2270
+ } else if (options.disabledWeekDays.indexOf(day) !== -1) {
2271
+ classes.push('xdsoft_disabled');
2272
+ }
2273
+
2274
+ if (customDateSettings && customDateSettings[1] !== "") {
2275
+ classes.push(customDateSettings[1]);
2276
+ }
2277
+
2278
+ if (_xdsoft_datetime.currentTime.getMonth() !== m) {
2279
+ classes.push('xdsoft_other_month');
2280
+ }
2281
+
2282
+ if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
2283
+ classes.push('xdsoft_current');
2284
+ }
2285
+
2286
+ if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
2287
+ classes.push('xdsoft_today');
2288
+ }
2289
+
2290
+ if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
2291
+ classes.push('xdsoft_weekend');
2292
+ }
2293
+
2294
+ if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
2295
+ hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
2296
+ classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
2297
+ description = hDate.desc === undefined ? '' : hDate.desc;
2298
+ }
2299
+
2300
+ if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
2301
+ classes.push(options.beforeShowDay(start));
2302
+ }
2303
+
2304
+ if (newRow) {
2305
+ table += '<tr>';
2306
+ newRow = false;
2307
+ if (options.weeks) {
2308
+ table += '<th>' + w + '</th>';
2309
+ }
2310
+ }
2311
+
2312
+ table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
2313
+ '<div>' + d + '</div>' +
2314
+ '</td>';
2315
+
2316
+ if (start.getDay() === options.dayOfWeekStartPrev) {
2317
+ table += '</tr>';
2318
+ newRow = true;
2319
+ }
2320
+
2321
+ start.setDate(d + 1);
2322
+ }
2323
+ table += '</tbody></table>';
2324
+
2325
+ calendar.html(table);
2326
+
2327
+ mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
2328
+ mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
2329
+
2330
+ // generate timebox
2331
+ time = '';
2332
+ h = '';
2333
+ m = '';
2334
+
2335
+ line_time = function line_time(h, m) {
2336
+ var now = _xdsoft_datetime.now(), optionDateTime, current_time,
2337
+ isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
2338
+ now.setHours(h);
2339
+ h = parseInt(now.getHours(), 10);
2340
+ now.setMinutes(m);
2341
+ m = parseInt(now.getMinutes(), 10);
2342
+ optionDateTime = new Date(_xdsoft_datetime.currentTime);
2343
+ optionDateTime.setHours(h);
2344
+ optionDateTime.setMinutes(m);
2345
+ classes = [];
2346
+ 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())) {
2347
+ classes.push('xdsoft_disabled');
2348
+ }
2349
+ 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()))) {
2350
+ classes.push('xdsoft_disabled');
2351
+ }
2352
+
2353
+ current_time = new Date(_xdsoft_datetime.currentTime);
2354
+ current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
2355
+
2356
+ if (!isALlowTimesInit) {
2357
+ current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
2358
+ }
2359
+
2360
+ if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
2361
+ if (options.defaultSelect || datetimepicker.data('changed')) {
2362
+ classes.push('xdsoft_current');
2363
+ } else if (options.initTime) {
2364
+ classes.push('xdsoft_init_time');
2365
+ }
2366
+ }
2367
+ if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
2368
+ classes.push('xdsoft_today');
2369
+ }
2370
+ time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>';
2371
+ };
2372
+
2373
+ if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
2374
+ for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
2375
+ for (j = 0; j < 60; j += options.step) {
2376
+ h = (i < 10 ? '0' : '') + i;
2377
+ m = (j < 10 ? '0' : '') + j;
2378
+ line_time(h, m);
2379
+ }
2380
+ }
2381
+ } else {
2382
+ for (i = 0; i < options.allowTimes.length; i += 1) {
2383
+ h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
2384
+ m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
2385
+ line_time(h, m);
2386
+ }
2387
+ }
2388
+
2389
+ timebox.html(time);
2390
+
2391
+ opt = '';
2392
+ i = 0;
2393
+
2394
+ for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) {
2395
+ opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>';
2396
+ }
2397
+ yearselect.children().eq(0)
2398
+ .html(opt);
2399
+
2400
+ for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
2401
+ opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
2402
+ }
2403
+ monthselect.children().eq(0).html(opt);
2404
+ $(datetimepicker)
2405
+ .trigger('generate.xdsoft');
2406
+ }, 10);
2407
+ event.stopPropagation();
2408
+ })
2409
+ .on('afterOpen.xdsoft', function () {
2410
+ if (options.timepicker) {
2411
+ var classType, pheight, height, top;
2412
+ if (timebox.find('.xdsoft_current').length) {
2413
+ classType = '.xdsoft_current';
2414
+ } else if (timebox.find('.xdsoft_init_time').length) {
2415
+ classType = '.xdsoft_init_time';
2416
+ }
2417
+ if (classType) {
2418
+ pheight = timeboxparent[0].clientHeight;
2419
+ height = timebox[0].offsetHeight;
2420
+ top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
2421
+ if ((height - pheight) < top) {
2422
+ top = height - pheight;
2423
+ }
2424
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
2425
+ } else {
2426
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
2427
+ }
2428
+ }
2429
+ });
2430
+
2431
+ timerclick = 0;
2432
+ calendar
2433
+ .on('touchend click.xdsoft', 'td', function (xdevent) {
2434
+ xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
2435
+ timerclick += 1;
2436
+ var $this = $(this),
2437
+ currentTime = _xdsoft_datetime.currentTime;
2438
+
2439
+ if (currentTime === undefined || currentTime === null) {
2440
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
2441
+ currentTime = _xdsoft_datetime.currentTime;
2442
+ }
2443
+
2444
+ if ($this.hasClass('xdsoft_disabled')) {
2445
+ return false;
2446
+ }
2447
+
2448
+ currentTime.setDate(1);
2449
+ currentTime.setFullYear($this.data('year'));
2450
+ currentTime.setMonth($this.data('month'));
2451
+ currentTime.setDate($this.data('date'));
2452
+
2453
+ datetimepicker.trigger('select.xdsoft', [currentTime]);
2454
+
2455
+ input.val(_xdsoft_datetime.str());
2456
+
2457
+ if (options.onSelectDate && $.isFunction(options.onSelectDate)) {
2458
+ options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
2459
+ }
2460
+
2461
+ datetimepicker.data('changed', true);
2462
+ datetimepicker.trigger('xchange.xdsoft');
2463
+ datetimepicker.trigger('changedatetime.xdsoft');
2464
+ if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
2465
+ datetimepicker.trigger('close.xdsoft');
2466
+ }
2467
+ setTimeout(function () {
2468
+ timerclick = 0;
2469
+ }, 200);
2470
+ });
2471
+
2472
+ timebox
2473
+ .on('touchend click.xdsoft', 'div', function (xdevent) {
2474
+ xdevent.stopPropagation();
2475
+ var $this = $(this),
2476
+ currentTime = _xdsoft_datetime.currentTime;
2477
+
2478
+ if (currentTime === undefined || currentTime === null) {
2479
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
2480
+ currentTime = _xdsoft_datetime.currentTime;
2481
+ }
2482
+
2483
+ if ($this.hasClass('xdsoft_disabled')) {
2484
+ return false;
2485
+ }
2486
+ currentTime.setHours($this.data('hour'));
2487
+ currentTime.setMinutes($this.data('minute'));
2488
+ datetimepicker.trigger('select.xdsoft', [currentTime]);
2489
+
2490
+ datetimepicker.data('input').val(_xdsoft_datetime.str());
2491
+
2492
+ if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
2493
+ options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
2494
+ }
2495
+ datetimepicker.data('changed', true);
2496
+ datetimepicker.trigger('xchange.xdsoft');
2497
+ datetimepicker.trigger('changedatetime.xdsoft');
2498
+ if (options.inline !== true && options.closeOnTimeSelect === true) {
2499
+ datetimepicker.trigger('close.xdsoft');
2500
+ }
2501
+ });
2502
+
2503
+
2504
+ datepicker
2505
+ .on('mousewheel.xdsoft', function (event) {
2506
+ if (!options.scrollMonth) {
2507
+ return true;
2508
+ }
2509
+ if (event.deltaY < 0) {
2510
+ _xdsoft_datetime.nextMonth();
2511
+ } else {
2512
+ _xdsoft_datetime.prevMonth();
2513
+ }
2514
+ return false;
2515
+ });
2516
+
2517
+ input
2518
+ .on('mousewheel.xdsoft', function (event) {
2519
+ if (!options.scrollInput) {
2520
+ return true;
2521
+ }
2522
+ if (!options.datepicker && options.timepicker) {
2523
+ current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
2524
+ if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
2525
+ current_time_index += event.deltaY;
2526
+ }
2527
+ if (timebox.children().eq(current_time_index).length) {
2528
+ timebox.children().eq(current_time_index).trigger('mousedown');
2529
+ }
2530
+ return false;
2531
+ }
2532
+ if (options.datepicker && !options.timepicker) {
2533
+ datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
2534
+ if (input.val) {
2535
+ input.val(_xdsoft_datetime.str());
2536
+ }
2537
+ datetimepicker.trigger('changedatetime.xdsoft');
2538
+ return false;
2539
+ }
2540
+ });
2541
+
2542
+ datetimepicker
2543
+ .on('changedatetime.xdsoft', function (event) {
2544
+ if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
2545
+ var $input = datetimepicker.data('input');
2546
+ options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
2547
+ delete options.value;
2548
+ $input.trigger('change');
2549
+ }
2550
+ })
2551
+ .on('generate.xdsoft', function () {
2552
+ if (options.onGenerate && $.isFunction(options.onGenerate)) {
2553
+ options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
2554
+ }
2555
+ if (triggerAfterOpen) {
2556
+ datetimepicker.trigger('afterOpen.xdsoft');
2557
+ triggerAfterOpen = false;
2558
+ }
2559
+ })
2560
+ .on('click.xdsoft', function (xdevent) {
2561
+ xdevent.stopPropagation();
2562
+ });
2563
+
2564
+ current_time_index = 0;
2565
+
2566
+ setPos = function () {
2567
+ /**
2568
+ * 修复输入框在window最右边,且输入框的宽度小于日期控件宽度情况下,日期控件显示不全的bug。
2569
+ * Bug fixed - The datetimepicker will overflow-y when the width of the date input less than its, which
2570
+ * could causes part of the datetimepicker being hidden.
2571
+ * by Soon start
2572
+ */
2573
+ var offset = datetimepicker.data('input').offset(),
2574
+ datetimepickerelement = datetimepicker.data('input')[0],
2575
+ top = offset.top + datetimepickerelement.offsetHeight - 1,
2576
+ left = offset.left,
2577
+ position = "absolute",
2578
+ node;
2579
+
2580
+ if ((document.documentElement.clientWidth - offset.left) < datepicker.parent().outerWidth(true)) {
2581
+ var diff = datepicker.parent().outerWidth(true) - datetimepickerelement.offsetWidth;
2582
+ left = left - diff;
2583
+ }
2584
+ /**
2585
+ * by Soon end
2586
+ */
2587
+ if (datetimepicker.data('input').parent().css('direction') == 'rtl')
2588
+ left -= (datetimepicker.outerWidth() - datetimepicker.data('input').outerWidth());
2589
+ if (options.fixed) {
2590
+ top -= $(window).scrollTop();
2591
+ left -= $(window).scrollLeft();
2592
+ position = "fixed";
2593
+ } else {
2594
+ if (top + datetimepickerelement.offsetHeight > $(window).height() + $(window).scrollTop()) {
2595
+ top = offset.top - datetimepickerelement.offsetHeight + 1;
2596
+ }
2597
+ if (top < 0) {
2598
+ top = 0;
2599
+ }
2600
+ if (left + datetimepickerelement.offsetWidth > $(window).width()) {
2601
+ left = $(window).width() - datetimepickerelement.offsetWidth;
2602
+ }
2603
+ }
2604
+
2605
+ node = datetimepicker[0];
2606
+ do {
2607
+ node = node.parentNode;
2608
+ if (window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) {
2609
+ left = left - (($(window).width() - node.offsetWidth) / 2);
2610
+ break;
2611
+ }
2612
+ } while (node.nodeName !== 'HTML');
2613
+ datetimepicker.css({
2614
+ left: left,
2615
+ top: top,
2616
+ position: position
2617
+ });
2618
+ };
2619
+ datetimepicker
2620
+ .on('open.xdsoft', function (event) {
2621
+ var onShow = true;
2622
+ if (options.onShow && $.isFunction(options.onShow)) {
2623
+ onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
2624
+ }
2625
+ if (onShow !== false) {
2626
+ datetimepicker.show();
2627
+ setPos();
2628
+ $(window)
2629
+ .off('resize.xdsoft', setPos)
2630
+ .on('resize.xdsoft', setPos);
2631
+
2632
+ if (options.closeOnWithoutClick) {
2633
+ $([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
2634
+ datetimepicker.trigger('close.xdsoft');
2635
+ $([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6);
2636
+ });
2637
+ }
2638
+ }
2639
+ })
2640
+ .on('close.xdsoft', function (event) {
2641
+ var onClose = true;
2642
+ mounth_picker
2643
+ .find('.xdsoft_month,.xdsoft_year')
2644
+ .find('.xdsoft_select')
2645
+ .hide();
2646
+ if (options.onClose && $.isFunction(options.onClose)) {
2647
+ onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
2648
+ }
2649
+ if (onClose !== false && !options.opened && !options.inline) {
2650
+ datetimepicker.hide();
2651
+ }
2652
+ event.stopPropagation();
2653
+ })
2654
+ .on('toggle.xdsoft', function (event) {
2655
+ if (datetimepicker.is(':visible')) {
2656
+ datetimepicker.trigger('close.xdsoft');
2657
+ } else {
2658
+ datetimepicker.trigger('open.xdsoft');
2659
+ }
2660
+ })
2661
+ .data('input', input);
2662
+
2663
+ timer = 0;
2664
+ timer1 = 0;
2665
+
2666
+ datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
2667
+ datetimepicker.setOptions(options);
2668
+
2669
+ function getCurrentValue() {
2670
+ var ct = false, time;
2671
+
2672
+ if (options.startDate) {
2673
+ ct = _xdsoft_datetime.strToDate(options.startDate);
2674
+ } else {
2675
+ ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
2676
+ if (ct) {
2677
+ ct = _xdsoft_datetime.strToDateTime(ct);
2678
+ } else if (options.defaultDate) {
2679
+ ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
2680
+ if (options.defaultTime) {
2681
+ time = _xdsoft_datetime.strtotime(options.defaultTime);
2682
+ ct.setHours(time.getHours());
2683
+ ct.setMinutes(time.getMinutes());
2684
+ }
2685
+ }
2686
+ }
2687
+
2688
+ if (ct && _xdsoft_datetime.isValidDate(ct)) {
2689
+ datetimepicker.data('changed', true);
2690
+ } else {
2691
+ ct = '';
2692
+ }
2693
+
2694
+ return ct || 0;
2695
+ }
2696
+
2697
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
2698
+
2699
+ input
2700
+ .data('xdsoft_datetimepicker', datetimepicker)
2701
+ .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function (event) {
2702
+ if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
2703
+ return;
2704
+ }
2705
+ clearTimeout(timer);
2706
+ timer = setTimeout(function () {
2707
+ if (input.is(':disabled')) {
2708
+ return;
2709
+ }
2710
+
2711
+ triggerAfterOpen = true;
2712
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
2713
+
2714
+ datetimepicker.trigger('open.xdsoft');
2715
+ }, 100);
2716
+ })
2717
+ .on('keydown.xdsoft', function (event) {
2718
+ var val = this.value, elementSelector,
2719
+ key = event.which;
2720
+ if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
2721
+ elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
2722
+ datetimepicker.trigger('close.xdsoft');
2723
+ elementSelector.eq(elementSelector.index(this) + 1).focus();
2724
+ return false;
2725
+ }
2726
+ if ([TAB].indexOf(key) !== -1) {
2727
+ datetimepicker.trigger('close.xdsoft');
2728
+ return true;
2729
+ }
2730
+ });
2731
+ };
2732
+ destroyDateTimePicker = function (input) {
2733
+ var datetimepicker = input.data('xdsoft_datetimepicker');
2734
+ if (datetimepicker) {
2735
+ datetimepicker.data('xdsoft_datetime', null);
2736
+ datetimepicker.remove();
2737
+ input
2738
+ .data('xdsoft_datetimepicker', null)
2739
+ .off('.xdsoft');
2740
+ $(window).off('resize.xdsoft');
2741
+ $([window, document.body]).off('mousedown.xdsoft touchstart');
2742
+ if (input.unmousewheel) {
2743
+ input.unmousewheel();
2744
+ }
2745
+ }
2746
+ };
2747
+ $(document)
2748
+ .off('keydown.xdsoftctrl keyup.xdsoftctrl')
2749
+ .on('keydown.xdsoftctrl', function (e) {
2750
+ if (e.keyCode === CTRLKEY) {
2751
+ ctrlDown = true;
2752
+ }
2753
+ })
2754
+ .on('keyup.xdsoftctrl', function (e) {
2755
+ if (e.keyCode === CTRLKEY) {
2756
+ ctrlDown = false;
2757
+ }
2758
+ });
2759
+ return this.each(function () {
2760
+ var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
2761
+ if (datetimepicker) {
2762
+ if ($.type(opt) === 'string') {
2763
+ switch (opt) {
2764
+ case 'show':
2765
+ $(this).select().focus();
2766
+ datetimepicker.trigger('open.xdsoft');
2767
+ break;
2768
+ case 'hide':
2769
+ datetimepicker.trigger('close.xdsoft');
2770
+ break;
2771
+ case 'toggle':
2772
+ datetimepicker.trigger('toggle.xdsoft');
2773
+ break;
2774
+ case 'destroy':
2775
+ destroyDateTimePicker($(this));
2776
+ break;
2777
+ case 'reset':
2778
+ this.value = this.defaultValue;
2779
+ if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
2780
+ datetimepicker.data('changed', false);
2781
+ }
2782
+ datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
2783
+ break;
2784
+ case 'validate':
2785
+ $input = datetimepicker.data('input');
2786
+ $input.trigger('blur.xdsoft');
2787
+ break;
2788
+ }
2789
+ } else {
2790
+ datetimepicker
2791
+ .setOptions(opt);
2792
+ }
2793
+ return 0;
2794
+ }
2795
+ if ($.type(opt) !== 'string') {
2796
+ if (!options.lazyInit || options.open || options.inline) {
2797
+ createDateTimePicker($(this));
2798
+ } else {
2799
+ lazyInit($(this));
2800
+ }
2801
+ }
2802
+ });
2803
+ };
2804
+ $.fn.datetimepicker.defaults = default_options;
2805
+
2806
+ function HighlightedDate(date, desc, style) {
2807
+ "use strict";
2808
+ this.date = date;
2809
+ this.desc = desc;
2810
+ this.style = style;
2811
+ }
2812
+
2813
+ }));
2814
+ /*!
2815
+ * jQuery Mousewheel 3.1.13
2816
+ *
2817
+ * Copyright jQuery Foundation and other contributors
2818
+ * Released under the MIT license
2819
+ * http://jquery.org/license
2820
+ */
2821
+
2822
+ (function (factory) {
2823
+ if ( typeof define === 'function' && define.amd ) {
2824
+ // AMD. Register as an anonymous module.
2825
+ define(['jquery'], factory);
2826
+ } else if (typeof exports === 'object') {
2827
+ // Node/CommonJS style for Browserify
2828
+ module.exports = factory;
2829
+ } else {
2830
+ // Browser globals
2831
+ factory(jQuery);
2832
+ }
2833
+ }(function ($) {
2834
+
2835
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
2836
+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
2837
+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
2838
+ slice = Array.prototype.slice,
2839
+ nullLowestDeltaTimeout, lowestDelta;
2840
+
2841
+ if ( $.event.fixHooks ) {
2842
+ for ( var i = toFix.length; i; ) {
2843
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
2844
+ }
2845
+ }
2846
+
2847
+ var special = $.event.special.mousewheel = {
2848
+ version: '3.1.12',
2849
+
2850
+ setup: function() {
2851
+ if ( this.addEventListener ) {
2852
+ for ( var i = toBind.length; i; ) {
2853
+ this.addEventListener( toBind[--i], handler, false );
2854
+ }
2855
+ } else {
2856
+ this.onmousewheel = handler;
2857
+ }
2858
+ // Store the line height and page height for this particular element
2859
+ $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
2860
+ $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
2861
+ },
2862
+
2863
+ teardown: function() {
2864
+ if ( this.removeEventListener ) {
2865
+ for ( var i = toBind.length; i; ) {
2866
+ this.removeEventListener( toBind[--i], handler, false );
2867
+ }
2868
+ } else {
2869
+ this.onmousewheel = null;
2870
+ }
2871
+ // Clean up the data we added to the element
2872
+ $.removeData(this, 'mousewheel-line-height');
2873
+ $.removeData(this, 'mousewheel-page-height');
2874
+ },
2875
+
2876
+ getLineHeight: function(elem) {
2877
+ var $elem = $(elem),
2878
+ $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
2879
+ if (!$parent.length) {
2880
+ $parent = $('body');
2881
+ }
2882
+ return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
2883
+ },
2884
+
2885
+ getPageHeight: function(elem) {
2886
+ return $(elem).height();
2887
+ },
2888
+
2889
+ settings: {
2890
+ adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
2891
+ normalizeOffset: true // calls getBoundingClientRect for each event
2892
+ }
2893
+ };
2894
+
2895
+ $.fn.extend({
2896
+ mousewheel: function(fn) {
2897
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
2898
+ },
2899
+
2900
+ unmousewheel: function(fn) {
2901
+ return this.unbind('mousewheel', fn);
2902
+ }
2903
+ });
2904
+
2905
+
2906
+ function handler(event) {
2907
+ var orgEvent = event || window.event,
2908
+ args = slice.call(arguments, 1),
2909
+ delta = 0,
2910
+ deltaX = 0,
2911
+ deltaY = 0,
2912
+ absDelta = 0,
2913
+ offsetX = 0,
2914
+ offsetY = 0;
2915
+ event = $.event.fix(orgEvent);
2916
+ event.type = 'mousewheel';
2917
+
2918
+ // Old school scrollwheel delta
2919
+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
2920
+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
2921
+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
2922
+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
2923
+
2924
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
2925
+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
2926
+ deltaX = deltaY * -1;
2927
+ deltaY = 0;
2928
+ }
2929
+
2930
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
2931
+ delta = deltaY === 0 ? deltaX : deltaY;
2932
+
2933
+ // New school wheel delta (wheel event)
2934
+ if ( 'deltaY' in orgEvent ) {
2935
+ deltaY = orgEvent.deltaY * -1;
2936
+ delta = deltaY;
2937
+ }
2938
+ if ( 'deltaX' in orgEvent ) {
2939
+ deltaX = orgEvent.deltaX;
2940
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
2941
+ }
2942
+
2943
+ // No change actually happened, no reason to go any further
2944
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
2945
+
2946
+ // Need to convert lines and pages to pixels if we aren't already in pixels
2947
+ // There are three delta modes:
2948
+ // * deltaMode 0 is by pixels, nothing to do
2949
+ // * deltaMode 1 is by lines
2950
+ // * deltaMode 2 is by pages
2951
+ if ( orgEvent.deltaMode === 1 ) {
2952
+ var lineHeight = $.data(this, 'mousewheel-line-height');
2953
+ delta *= lineHeight;
2954
+ deltaY *= lineHeight;
2955
+ deltaX *= lineHeight;
2956
+ } else if ( orgEvent.deltaMode === 2 ) {
2957
+ var pageHeight = $.data(this, 'mousewheel-page-height');
2958
+ delta *= pageHeight;
2959
+ deltaY *= pageHeight;
2960
+ deltaX *= pageHeight;
2961
+ }
2962
+
2963
+ // Store lowest absolute delta to normalize the delta values
2964
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
2965
+
2966
+ if ( !lowestDelta || absDelta < lowestDelta ) {
2967
+ lowestDelta = absDelta;
2968
+
2969
+ // Adjust older deltas if necessary
2970
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
2971
+ lowestDelta /= 40;
2972
+ }
2973
+ }
2974
+
2975
+ // Adjust older deltas if necessary
2976
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
2977
+ // Divide all the things by 40!
2978
+ delta /= 40;
2979
+ deltaX /= 40;
2980
+ deltaY /= 40;
2981
+ }
2982
+
2983
+ // Get a whole, normalized value for the deltas
2984
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
2985
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
2986
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
2987
+
2988
+ // Normalise offsetX and offsetY properties
2989
+ if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
2990
+ var boundingRect = this.getBoundingClientRect();
2991
+ offsetX = event.clientX - boundingRect.left;
2992
+ offsetY = event.clientY - boundingRect.top;
2993
+ }
2994
+
2995
+ // Add information to the event object
2996
+ event.deltaX = deltaX;
2997
+ event.deltaY = deltaY;
2998
+ event.deltaFactor = lowestDelta;
2999
+ event.offsetX = offsetX;
3000
+ event.offsetY = offsetY;
3001
+ // Go ahead and set deltaMode to 0 since we converted to pixels
3002
+ // Although this is a little odd since we overwrite the deltaX/Y
3003
+ // properties with normalized deltas.
3004
+ event.deltaMode = 0;
3005
+
3006
+ // Add event and delta to the front of the arguments
3007
+ args.unshift(event, delta, deltaX, deltaY);
3008
+
3009
+ // Clearout lowestDelta after sometime to better
3010
+ // handle multiple device types that give different
3011
+ // a different lowestDelta
3012
+ // Ex: trackpad = 3 and mouse wheel = 120
3013
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
3014
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
3015
+
3016
+ return ($.event.dispatch || $.event.handle).apply(this, args);
3017
+ }
3018
+
3019
+ function nullLowestDelta() {
3020
+ lowestDelta = null;
3021
+ }
3022
+
3023
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
3024
+ // If this is an older event and the delta is divisable by 120,
3025
+ // then we are assuming that the browser is treating this as an
3026
+ // older mouse wheel event and that we should divide the deltas
3027
+ // by 40 to try and get a more usable deltaFactor.
3028
+ // Side note, this actually impacts the reported scroll distance
3029
+ // in older browsers and can cause scrolling to be slower than native.
3030
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
3031
+ return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
3032
+ }
3033
+
3034
+ }));