xdan-datetimepicker-rails 2.4.1 → 2.4.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00896cc12400d16a48440fa43bcbadd40855083b
4
- data.tar.gz: fd0ad32a238fe313220e254489fce0389704ca56
3
+ metadata.gz: 47a6d4c3a6ce82e2d44acca0ad9456e6790f63af
4
+ data.tar.gz: 110d31859d0a6a2a0366b72809c2438d84b93b88
5
5
  SHA512:
6
- metadata.gz: 17ebbb0f709c70952c82181b7d5e876924c1e59785fdf3b66e39423922db4854e530d0948a2198562b969ea9a7c0dfe2a3befc3e3809f7fa3d5d5568d0a1b6e0
7
- data.tar.gz: dd2d34ced2ba0187943de302f9813c9e5b8cf5920dda2d7a0c90bef9d9aa550912343e782d7815803821de6e4f00cde9045cd7594cec7d721561e656aeed369a
6
+ metadata.gz: 815011a1b003ff07c91c180431338ebc3f7d74c6d59498aa8406549da2ad6b281751f26542b5feb2152cc64b669e719eedc6d9e8e8f43a48899d4f23bce1ceef
7
+ data.tar.gz: 29cbc586a8cbf7f027013b30f53a3a83a3fea99700f96706b8e13e94d4888903d119744d1413fa828cadce158309941830ec8f0e0557e64a5e3a5ec705e6f6bd
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.4.1
2
+ * @preserve jQuery DateTimePicker plugin v2.4.2
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
4
  * (c) 2014, Chupurnov Valeriy.
5
5
  */
6
- /*global document,window,jQuery,setTimeout,clearTimeout*/
6
+ /*global document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
7
7
  (function ($) {
8
8
  'use strict';
9
9
  var default_options = {
@@ -29,7 +29,7 @@
29
29
  "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
30
30
  ],
31
31
  dayOfWeek: [
32
- "Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Min"
32
+ "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
33
33
  ]
34
34
  },
35
35
  bg: { // Bulgarian
@@ -423,7 +423,15 @@
423
423
  dayOfWeek: [
424
424
  "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
425
425
  ]
426
- }
426
+ },
427
+ kg: { // Kyrgyz
428
+ months: [
429
+ 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
430
+ ],
431
+ dayOfWeek: [
432
+ "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
433
+ ]
434
+ }
427
435
  },
428
436
  value: '',
429
437
  lang: 'en',
@@ -437,6 +445,7 @@
437
445
  monthChangeSpinner: true,
438
446
 
439
447
  closeOnDateSelect: false,
448
+ closeOnTimeSelect: true,
440
449
  closeOnWithoutClick: true,
441
450
  closeOnInputClick: true,
442
451
 
@@ -470,13 +479,15 @@
470
479
  withoutCopyright: true,
471
480
  inverseButton: false,
472
481
  hours12: false,
473
- next: 'xdsoft_next',
482
+ next: 'xdsoft_next',
474
483
  prev : 'xdsoft_prev',
475
484
  dayOfWeekStart: 0,
476
485
  parentID: 'body',
477
486
  timeHeightInTimePicker: 25,
478
487
  timepickerScrollbar: true,
479
488
  todayButton: true,
489
+ prevButton: true,
490
+ nextButton: true,
480
491
  defaultSelect: true,
481
492
 
482
493
  scrollMonth: true,
@@ -489,17 +500,22 @@
489
500
  allowBlank: true,
490
501
  yearStart: 1950,
491
502
  yearEnd: 2050,
503
+ monthStart: 0,
504
+ monthEnd: 11,
492
505
  style: '',
493
506
  id: '',
494
507
  fixed: false,
495
508
  roundTime: 'round', // ceil, floor
496
509
  className: '',
497
510
  weekends: [],
511
+ highlightedDates: [],
512
+ highlightedPeriods: [],
498
513
  disabledDates : [],
499
514
  yearOffset: 0,
500
515
  beforeShowDay: null,
501
516
 
502
- enterLikeTab: true
517
+ enterLikeTab: true,
518
+ showApplyButton: false
503
519
  };
504
520
  // fix for ie8
505
521
  if (!Array.prototype.indexOf) {
@@ -730,6 +746,7 @@
730
746
  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>'),
731
747
  timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
732
748
  timebox = $('<div class="xdsoft_time_variant"></div>'),
749
+ applyButton = $('<button class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
733
750
  /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
734
751
  scroller = $('<div class="xdsoft_scroller"></div>'),*/
735
752
  monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
@@ -791,6 +808,11 @@
791
808
  event.preventDefault();
792
809
  })
793
810
  .on('mousedown.xdsoft', '.xdsoft_option', function (event) {
811
+
812
+ if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
813
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
814
+ }
815
+
794
816
  var year = _xdsoft_datetime.currentTime.getFullYear();
795
817
  if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
796
818
  _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
@@ -809,6 +831,48 @@
809
831
  });
810
832
 
811
833
  datetimepicker.setOptions = function (_options) {
834
+ var highlightedDates = {},
835
+ getCaretPos = function (input) {
836
+ try {
837
+ if (document.selection && document.selection.createRange) {
838
+ var range = document.selection.createRange();
839
+ return range.getBookmark().charCodeAt(2) - 2;
840
+ }
841
+ if (input.setSelectionRange) {
842
+ return input.selectionStart;
843
+ }
844
+ } catch (e) {
845
+ return 0;
846
+ }
847
+ },
848
+ setCaretPos = function (node, pos) {
849
+ node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
850
+ if (!node) {
851
+ return false;
852
+ }
853
+ if (node.createTextRange) {
854
+ var textRange = node.createTextRange();
855
+ textRange.collapse(true);
856
+ textRange.moveEnd('character', pos);
857
+ textRange.moveStart('character', pos);
858
+ textRange.select();
859
+ return true;
860
+ }
861
+ if (node.setSelectionRange) {
862
+ node.setSelectionRange(pos, pos);
863
+ return true;
864
+ }
865
+ return false;
866
+ },
867
+ isValidValue = function (mask, value) {
868
+ var reg = mask
869
+ .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
870
+ .replace(/_/g, '{digit+}')
871
+ .replace(/([0-9]{1})/g, '{digit$1}')
872
+ .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
873
+ .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
874
+ return (new RegExp(reg)).test(value);
875
+ };
812
876
  options = $.extend(true, {}, options, _options);
813
877
 
814
878
  if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
@@ -819,9 +883,58 @@
819
883
  options.weekends = $.extend(true, [], _options.weekends);
820
884
  }
821
885
 
886
+ if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
887
+ $.each(_options.highlightedDates, function (index, value) {
888
+ var splitData = $.map(value.split(','), $.trim),
889
+ exDesc,
890
+ hDate = new HighlightedDate(Date.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
891
+ keyDate = hDate.date.dateFormat(options.formatDate);
892
+ if (highlightedDates[keyDate] !== undefined) {
893
+ exDesc = highlightedDates[keyDate].desc;
894
+ if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
895
+ highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
896
+ }
897
+ } else {
898
+ highlightedDates[keyDate] = hDate;
899
+ }
900
+ });
901
+
902
+ options.highlightedDates = $.extend(true, [], highlightedDates);
903
+ }
904
+
905
+ if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
906
+ highlightedDates = $.extend(true, [], options.highlightedDates);
907
+ $.each(_options.highlightedPeriods, function (index, value) {
908
+ var splitData = $.map(value.split(','), $.trim),
909
+ dateTest = Date.parseDate(splitData[0], options.formatDate), // start date
910
+ dateEnd = Date.parseDate(splitData[1], options.formatDate),
911
+ desc = splitData[2],
912
+ hDate,
913
+ keyDate,
914
+ exDesc,
915
+ style = splitData[3];
916
+
917
+ while (dateTest <= dateEnd) {
918
+ hDate = new HighlightedDate(dateTest, desc, style);
919
+ keyDate = dateTest.dateFormat(options.formatDate);
920
+ dateTest.setDate(dateTest.getDate() + 1);
921
+ if (highlightedDates[keyDate] !== undefined) {
922
+ exDesc = highlightedDates[keyDate].desc;
923
+ if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
924
+ highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
925
+ }
926
+ } else {
927
+ highlightedDates[keyDate] = hDate;
928
+ }
929
+ }
930
+ });
931
+
932
+ options.highlightedDates = $.extend(true, [], highlightedDates);
933
+ }
934
+
822
935
  if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
823
- options.disabledDates = $.extend(true, [], _options.disabledDates);
824
- }
936
+ options.disabledDates = $.extend(true, [], _options.disabledDates);
937
+ }
825
938
 
826
939
  if ((options.open || options.opened) && (!options.inline)) {
827
940
  input.trigger('open.xdsoft');
@@ -851,10 +964,10 @@
851
964
  }
852
965
 
853
966
  if (options.value) {
967
+ _xdsoft_datetime.setCurrentTime(options.value);
854
968
  if (input && input.val) {
855
- input.val(options.value);
969
+ input.val(_xdsoft_datetime.str);
856
970
  }
857
- _xdsoft_datetime.setCurrentTime(options.value);
858
971
  }
859
972
 
860
973
  if (isNaN(options.dayOfWeekStart)) {
@@ -875,53 +988,21 @@
875
988
  options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate);
876
989
  }
877
990
 
991
+ applyButton.toggle(options.showApplyButton);
992
+
878
993
  mounth_picker
879
994
  .find('.xdsoft_today_button')
880
995
  .css('visibility', !options.todayButton ? 'hidden' : 'visible');
881
996
 
997
+ mounth_picker
998
+ .find('.' + options.prev)
999
+ .css('visibility', !options.prevButton ? 'hidden' : 'visible');
1000
+
1001
+ mounth_picker
1002
+ .find('.' + options.next)
1003
+ .css('visibility', !options.nextButton ? 'hidden' : 'visible');
1004
+
882
1005
  if (options.mask) {
883
- var e,
884
- getCaretPos = function (input) {
885
- try {
886
- if (document.selection && document.selection.createRange) {
887
- var range = document.selection.createRange();
888
- return range.getBookmark().charCodeAt(2) - 2;
889
- }
890
- if (input.setSelectionRange) {
891
- return input.selectionStart;
892
- }
893
- } catch (e) {
894
- return 0;
895
- }
896
- },
897
- setCaretPos = function (node, pos) {
898
- node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
899
- if (!node) {
900
- return false;
901
- }
902
- if (node.createTextRange) {
903
- var textRange = node.createTextRange();
904
- textRange.collapse(true);
905
- textRange.moveEnd('character', pos);
906
- textRange.moveStart('character', pos);
907
- textRange.select();
908
- return true;
909
- }
910
- if (node.setSelectionRange) {
911
- node.setSelectionRange(pos, pos);
912
- return true;
913
- }
914
- return false;
915
- },
916
- isValidValue = function (mask, value) {
917
- var reg = mask
918
- .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
919
- .replace(/_/g, '{digit+}')
920
- .replace(/([0-9]{1})/g, '{digit$1}')
921
- .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
922
- .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
923
- return (new RegExp(reg)).test(value);
924
- };
925
1006
  input.off('keydown.xdsoft');
926
1007
 
927
1008
  if (options.mask === true) {
@@ -997,28 +1078,28 @@
997
1078
  input
998
1079
  .off('blur.xdsoft')
999
1080
  .on('blur.xdsoft', function () {
1000
- if (options.allowBlank && !$.trim($(this).val()).length) {
1001
- $(this).val(null);
1002
- datetimepicker.data('xdsoft_datetime').empty();
1003
- } else if (!Date.parseDate($(this).val(), options.format)) {
1004
- var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
1005
- splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
1006
-
1007
- // parse the numbers as 0312 => 03:12
1008
- if(!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
1009
- $(this).val([splittedHours, splittedMinutes].map(function(item) {
1010
- return item > 9 ? item : '0' + item
1011
- }).join(':'));
1012
- } else {
1013
- $(this).val((_xdsoft_datetime.now()).dateFormat(options.format));
1014
- }
1015
-
1016
- datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1017
- } else {
1018
- datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1019
- }
1020
-
1021
- datetimepicker.trigger('changedatetime.xdsoft');
1081
+ if (options.allowBlank && !$.trim($(this).val()).length) {
1082
+ $(this).val(null);
1083
+ datetimepicker.data('xdsoft_datetime').empty();
1084
+ } else if (!Date.parseDate($(this).val(), options.format)) {
1085
+ var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
1086
+ splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
1087
+
1088
+ // parse the numbers as 0312 => 03:12
1089
+ if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
1090
+ $(this).val([splittedHours, splittedMinutes].map(function (item) {
1091
+ return item > 9 ? item : '0' + item;
1092
+ }).join(':'));
1093
+ } else {
1094
+ $(this).val((_xdsoft_datetime.now()).dateFormat(options.format));
1095
+ }
1096
+
1097
+ datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1098
+ } else {
1099
+ datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1100
+ }
1101
+
1102
+ datetimepicker.trigger('changedatetime.xdsoft');
1022
1103
  });
1023
1104
  }
1024
1105
  options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
@@ -1057,7 +1138,8 @@
1057
1138
 
1058
1139
  datepicker
1059
1140
  .append(mounth_picker)
1060
- .append(calendar);
1141
+ .append(calendar)
1142
+ .append(applyButton);
1061
1143
 
1062
1144
  $(options.parentID)
1063
1145
  .append(datetimepicker);
@@ -1070,7 +1152,7 @@
1070
1152
  time;
1071
1153
 
1072
1154
  if (!norecursion && options.defaultDate) {
1073
- date = _this.strToDate(options.defaultDate);
1155
+ date = _this.strToDateTime(options.defaultDate);
1074
1156
  d.setFullYear(date.getFullYear());
1075
1157
  d.setMonth(date.getMonth());
1076
1158
  d.setDate(date.getDate());
@@ -1085,7 +1167,6 @@
1085
1167
  d.setHours(time.getHours());
1086
1168
  d.setMinutes(time.getMinutes());
1087
1169
  }
1088
-
1089
1170
  return d;
1090
1171
  };
1091
1172
 
@@ -1110,6 +1191,11 @@
1110
1191
  };
1111
1192
 
1112
1193
  _this.nextMonth = function () {
1194
+
1195
+ if (_this.currentTime === undefined || _this.currentTime === null) {
1196
+ _this.currentTime = _this.now();
1197
+ }
1198
+
1113
1199
  var month = _this.currentTime.getMonth() + 1,
1114
1200
  year;
1115
1201
  if (month === 12) {
@@ -1140,6 +1226,11 @@
1140
1226
  };
1141
1227
 
1142
1228
  _this.prevMonth = function () {
1229
+
1230
+ if (_this.currentTime === undefined || _this.currentTime === null) {
1231
+ _this.currentTime = _this.now();
1232
+ }
1233
+
1143
1234
  var month = _this.currentTime.getMonth() - 1;
1144
1235
  if (month === -1) {
1145
1236
  _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
@@ -1177,7 +1268,7 @@
1177
1268
  }
1178
1269
  if (tmpDate && tmpDate[2]) {
1179
1270
  timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
1180
- currentTime = new Date((_xdsoft_datetime.now()).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
1271
+ currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
1181
1272
  } else {
1182
1273
  currentTime = sDateTime ? Date.parseDate(sDateTime, options.format) : _this.now();
1183
1274
  }
@@ -1194,7 +1285,7 @@
1194
1285
  return sDate;
1195
1286
  }
1196
1287
 
1197
- var currentTime = sDate ? Date.parseDate(sDate, options.formatDate) : _this.now(true);
1288
+ var currentTime = sDate ? Date.parse(sDate, options.formatDate) : _this.now(true);
1198
1289
  if (!_this.isValidDate(currentTime)) {
1199
1290
  currentTime = _this.now(true);
1200
1291
  }
@@ -1220,6 +1311,13 @@
1220
1311
 
1221
1312
  _xdsoft_datetime = new XDSoft_datetime();
1222
1313
 
1314
+ applyButton.on('click', function (e) {//pathbrite
1315
+ e.preventDefault();
1316
+ datetimepicker.data('changed', true);
1317
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
1318
+ input.val(_xdsoft_datetime.str());
1319
+ datetimepicker.trigger('close.xdsoft');
1320
+ });
1223
1321
  mounth_picker
1224
1322
  .find('.xdsoft_today_button')
1225
1323
  .on('mousedown.xdsoft', function () {
@@ -1238,7 +1336,6 @@
1238
1336
  stop = false;
1239
1337
 
1240
1338
  (function arguments_callee1(v) {
1241
- var month = _xdsoft_datetime.currentTime.getMonth();
1242
1339
  if ($this.hasClass(options.next)) {
1243
1340
  _xdsoft_datetime.nextMonth();
1244
1341
  } else if ($this.hasClass(options.prev)) {
@@ -1294,6 +1391,11 @@
1294
1391
  .on('xchange.xdsoft', function (event) {
1295
1392
  clearTimeout(xchangeTimer);
1296
1393
  xchangeTimer = setTimeout(function () {
1394
+
1395
+ if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
1396
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1397
+ }
1398
+
1297
1399
  var table = '',
1298
1400
  start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
1299
1401
  i = 0,
@@ -1301,6 +1403,7 @@
1301
1403
  today = _xdsoft_datetime.now(),
1302
1404
  maxDate = false,
1303
1405
  minDate = false,
1406
+ hDate,
1304
1407
  d,
1305
1408
  y,
1306
1409
  m,
@@ -1310,7 +1413,8 @@
1310
1413
  newRow = true,
1311
1414
  time = '',
1312
1415
  h = '',
1313
- line_time;
1416
+ line_time,
1417
+ description;
1314
1418
 
1315
1419
  while (start.getDay() !== options.dayOfWeekStart) {
1316
1420
  start.setDate(start.getDate() - 1);
@@ -1347,6 +1451,7 @@
1347
1451
  y = start.getFullYear();
1348
1452
  m = start.getMonth();
1349
1453
  w = _xdsoft_datetime.getWeekOfYear(start);
1454
+ description = '';
1350
1455
 
1351
1456
  classes.push('xdsoft_date');
1352
1457
 
@@ -1378,10 +1483,16 @@
1378
1483
  classes.push('xdsoft_today');
1379
1484
  }
1380
1485
 
1381
- if (start.getDay() === 0 || start.getDay() === 6 || ~options.weekends.indexOf(start.dateFormat(options.formatDate))) {
1486
+ if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) !== -1) {
1382
1487
  classes.push('xdsoft_weekend');
1383
1488
  }
1384
1489
 
1490
+ if (options.highlightedDates[start.dateFormat(options.formatDate)] !== undefined) {
1491
+ hDate = options.highlightedDates[start.dateFormat(options.formatDate)];
1492
+ classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
1493
+ description = hDate.desc === undefined ? '' : hDate.desc;
1494
+ }
1495
+
1385
1496
  if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
1386
1497
  classes.push(options.beforeShowDay(start));
1387
1498
  }
@@ -1394,7 +1505,7 @@
1394
1505
  }
1395
1506
  }
1396
1507
 
1397
- table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '">' +
1508
+ table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
1398
1509
  '<div>' + d + '</div>' +
1399
1510
  '</td>';
1400
1511
 
@@ -1417,19 +1528,24 @@
1417
1528
  h = '';
1418
1529
  m = '';
1419
1530
  line_time = function line_time(h, m) {
1420
- var now = _xdsoft_datetime.now();
1531
+ var now = _xdsoft_datetime.now(), optionDateTime, current_time;
1421
1532
  now.setHours(h);
1422
1533
  h = parseInt(now.getHours(), 10);
1423
1534
  now.setMinutes(m);
1424
1535
  m = parseInt(now.getMinutes(), 10);
1425
- var optionDateTime = new Date(_xdsoft_datetime.currentTime);
1536
+ optionDateTime = new Date(_xdsoft_datetime.currentTime);
1426
1537
  optionDateTime.setHours(h);
1427
1538
  optionDateTime.setMinutes(m);
1428
1539
  classes = [];
1429
- 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())) {
1540
+ 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())) {
1430
1541
  classes.push('xdsoft_disabled');
1431
1542
  }
1432
- if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours(), 10) === parseInt(h, 10) && (options.step > 59 || Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step === parseInt(m, 10))) {
1543
+
1544
+ current_time = new Date(_xdsoft_datetime.currentTime);
1545
+ current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
1546
+ current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
1547
+
1548
+ if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) {
1433
1549
  if (options.defaultSelect || datetimepicker.data('changed')) {
1434
1550
  classes.push('xdsoft_current');
1435
1551
  } else if (options.initTime) {
@@ -1469,7 +1585,7 @@
1469
1585
  yearselect.children().eq(0)
1470
1586
  .html(opt);
1471
1587
 
1472
- for (i = 0, opt = ''; i <= 11; i += 1) {
1588
+ for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
1473
1589
  opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[options.lang].months[i] + '</div>';
1474
1590
  }
1475
1591
  monthselect.children().eq(0).html(opt);
@@ -1560,9 +1676,10 @@
1560
1676
  datetimepicker.trigger('select.xdsoft', [currentTime]);
1561
1677
 
1562
1678
  datetimepicker.data('input').val(_xdsoft_datetime.str());
1563
- if (!options.inline) {
1564
- datetimepicker.trigger('close.xdsoft');
1565
- }
1679
+
1680
+ if (options.inline !== true && options.closeOnTimeSelect === true) {
1681
+ datetimepicker.trigger('close.xdsoft');
1682
+ }
1566
1683
 
1567
1684
  if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
1568
1685
  options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
@@ -1709,7 +1826,6 @@
1709
1826
  datetimepicker.setOptions(options);
1710
1827
 
1711
1828
  function getCurrentValue() {
1712
-
1713
1829
  var ct = false, time;
1714
1830
 
1715
1831
  if (options.startDate) {
@@ -1719,7 +1835,7 @@
1719
1835
  if (ct) {
1720
1836
  ct = _xdsoft_datetime.strToDateTime(ct);
1721
1837
  } else if (options.defaultDate) {
1722
- ct = _xdsoft_datetime.strToDate(options.defaultDate);
1838
+ ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
1723
1839
  if (options.defaultTime) {
1724
1840
  time = _xdsoft_datetime.strtotime(options.defaultTime);
1725
1841
  ct.setHours(time.getHours());
@@ -1800,7 +1916,7 @@
1800
1916
  }
1801
1917
  });
1802
1918
  return this.each(function () {
1803
- var datetimepicker = $(this).data('xdsoft_datetimepicker');
1919
+ var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
1804
1920
  if (datetimepicker) {
1805
1921
  if ($.type(opt) === 'string') {
1806
1922
  switch (opt) {
@@ -1824,6 +1940,10 @@
1824
1940
  }
1825
1941
  datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
1826
1942
  break;
1943
+ case 'validate':
1944
+ $input = datetimepicker.data('input');
1945
+ $input.trigger('blur.xdsoft');
1946
+ break;
1827
1947
  }
1828
1948
  } else {
1829
1949
  datetimepicker
@@ -1842,6 +1962,14 @@
1842
1962
  };
1843
1963
  $.fn.datetimepicker.defaults = default_options;
1844
1964
  }(jQuery));
1965
+
1966
+ function HighlightedDate(date, desc, style) {
1967
+ "use strict";
1968
+ this.date = date;
1969
+ this.desc = desc;
1970
+ this.style = style;
1971
+ }
1972
+
1845
1973
  (function () {
1846
1974
 
1847
1975
  /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
@@ -1867,5 +1995,5 @@
1867
1995
  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
1868
1996
  * details.
1869
1997
  */
1870
- Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var codePrefix="Date.prototype."+funcName+" = function() {return ";var code="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}if(code.length==0){code="\"\"";}else{code=code.substring(0,code.length-3);}eval(codePrefix+code+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};
1998
+ Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var codePrefix="Date.prototype."+funcName+" = function() {return ";var code="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}if(code.length==0){code="\"\"";}else{code=code.substring(0,code.length-3);}eval(codePrefix+code+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$",'i');eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};
1871
1999
  }());