jquery-datetimepicker-rails 2.1.9.0 → 2.2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 309e6b365fcc8d92c5ea9ba3b8bac71054a61829
4
- data.tar.gz: c153c56c5b1538a2ed748bbecd509542f699d34d
3
+ metadata.gz: 8e8fdc6e4aa30e5047e680d61072d5975a8c45bf
4
+ data.tar.gz: 9a6b03874766a70161cf6dfc06f5e843481c4866
5
5
  SHA512:
6
- metadata.gz: 0f51af4afc71fb2cc384917d0fd559652169e55c377f4930a7cee50d4855e3dca5a965bc28573963c26e66d07010255e8068766ca45822cc9f0b774d8225edb1
7
- data.tar.gz: af4fc97eff0a8e17ffef10e34e7b623e7d8302fb592b6ad3c54ec187fb691f2257a33e7c1c07560d46c9de9848f49d1608a909b97f3ec47b0be045c5dc8c2bc2
6
+ metadata.gz: c194136e9202fcbb67a16ec04edcbc5d813cd033a776e96d97556cbb6375a832cb194676b10df18ea830beb3bb559b9dd6519e2cf0871289f4a5a2f72982cc65
7
+ data.tar.gz: 428b8663e8b8e395743e56db784fe9e46e31d0c77754b3ad71587701e4b382fe36cabc56b291508eb1fbfb5f638c61da19199faf710340962ceca902003d168e
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.1.9
2
+ * @preserve jQuery DateTimePicker plugin v2.2.2
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
4
  * (c) 2014, Chupurnov Valeriy.
5
5
  */
@@ -28,7 +28,7 @@
28
28
  'Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'
29
29
  ],
30
30
  dayOfWeek:[
31
- "So.", "Mo", "Di", "Mi", "Do", "Fr", "Sa."
31
+ "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
32
32
  ]
33
33
  },
34
34
  nl:{ // Dutch
@@ -102,25 +102,61 @@
102
102
  dayOfWeek: [
103
103
  "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
104
104
  ]
105
- }
105
+ },
106
+ kr:{ // Korean
107
+ months: [
108
+ "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
109
+ ],
110
+ dayOfWeek: [
111
+ "일", "월", "화", "수", "목", "금", "토"
112
+ ]
113
+ },
114
+ it:{ // Italian
115
+ months: [
116
+ "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
117
+ ],
118
+ dayOfWeek: [
119
+ "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
120
+ ]
121
+ },
122
+ da:{ // Dansk
123
+ months: [
124
+ "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
125
+ ],
126
+ dayOfWeek: [
127
+ "Søn", "Man", "Tir", "ons", "Tor", "Fre", "lør"
128
+ ]
129
+ },
106
130
  },
107
131
  value:'',
108
- lang:'en',
109
- format:'Y/m/d H:i',
110
- formatTime:'H:i',
111
- formatDate:'Y/m/d',
132
+ lang: 'en',
133
+
134
+ format: 'Y/m/d H:i',
135
+ formatTime: 'H:i',
136
+ formatDate: 'Y/m/d',
137
+
138
+ startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
139
+
140
+ //fromUnixtime: false,
141
+
112
142
  step:60,
143
+
113
144
  closeOnDateSelect:0,
114
145
  closeOnWithoutClick:true,
146
+
115
147
  timepicker:true,
116
148
  datepicker:true,
149
+
117
150
  minDate:false,
118
151
  maxDate:false,
119
152
  minTime:false,
120
153
  maxTime:false,
154
+
121
155
  allowTimes:[],
122
156
  opened:false,
157
+ initTime:true,
123
158
  inline:false,
159
+
124
160
  onSelectDate:function() {},
125
161
  onSelectTime:function() {},
126
162
  onChangeMonth:function() {},
@@ -128,31 +164,42 @@
128
164
  onShow:function() {},
129
165
  onClose:function() {},
130
166
  onGenerate:function() {},
167
+
131
168
  withoutCopyright:true,
169
+
132
170
  inverseButton:false,
133
171
  hours12:false,
134
172
  next: 'xdsoft_next',
135
173
  prev : 'xdsoft_prev',
136
174
  dayOfWeekStart:0,
175
+
137
176
  timeHeightInTimePicker:25,
138
177
  timepickerScrollbar:true,
178
+
139
179
  todayButton:true, // 2.1.0
140
180
  defaultSelect:true, // 2.1.0
181
+
141
182
  scrollMonth:true,
142
183
  scrollTime:true,
143
184
  scrollInput:true,
185
+
144
186
  mask:false,
145
187
  validateOnBlur:true,
146
- allowBlank:false,
188
+ allowBlank:true,
189
+
147
190
  yearStart:1950,
148
191
  yearEnd:2050,
192
+
149
193
  style:'',
150
194
  id:'',
195
+
151
196
  roundTime:'round', // ceil, floor
152
197
  className:'',
198
+
153
199
  weekends : [],
154
200
  yearOffset:0
155
201
  };
202
+
156
203
  // fix for ie8
157
204
  if ( !Array.prototype.indexOf ) {
158
205
  Array.prototype.indexOf = function(obj, start) {
@@ -162,6 +209,7 @@
162
209
  return -1;
163
210
  }
164
211
  };
212
+
165
213
  $.fn.xdsoftScroller = function( _percent ) {
166
214
  return this.each(function() {
167
215
  var timeboxparent = $(this);
@@ -282,6 +330,7 @@
282
330
  YKEY = 89,
283
331
  ctrlDown = false,
284
332
  options = ($.isPlainObject(opt)||!opt)?$.extend(true,{},default_options,opt):$.extend({},default_options),
333
+
285
334
  createDateTimePicker = function( input ) {
286
335
  var datetimepicker = $('<div '+(options.id?'id="'+options.id+'"':'')+' '+(options.style?'style="'+options.style+'"':'')+' class="xdsoft_datetimepicker xdsoft_noselect '+options.className+'"></div>'),
287
336
  xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
@@ -310,6 +359,7 @@
310
359
  mounth_picker
311
360
  .find('.xdsoft_select')
312
361
  .hide();
362
+
313
363
  var select = $(this).find('.xdsoft_select').eq(0),
314
364
  val = 0,
315
365
  top = 0;
@@ -318,6 +368,7 @@
318
368
  val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month')?'getMonth':'getFullYear']();
319
369
 
320
370
  select.show();
371
+
321
372
  for(var items = select.find('div.xdsoft_option'),i = 0;i<items.length;i++) {
322
373
  if( items.eq(i).data('value')==val ) {
323
374
  break;
@@ -326,6 +377,7 @@
326
377
 
327
378
  select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].clientHeight)));
328
379
  event.stopPropagation();
380
+
329
381
  return false;
330
382
  });
331
383
 
@@ -339,7 +391,9 @@
339
391
  .on('mousedown.xdsoft','.xdsoft_option',function( event ) {
340
392
  if( _xdsoft_datetime&&_xdsoft_datetime.currentTime )
341
393
  _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect')?'setMonth':'setFullYear']($(this).data('value'));
394
+
342
395
  $(this).parent().parent().hide();
396
+
343
397
  datetimepicker.trigger('xchange.xdsoft');
344
398
  options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
345
399
  });
@@ -363,10 +417,14 @@
363
417
  options.prev = 'xdsoft_next';
364
418
  }
365
419
 
366
- if( !options.datepicker && options.timepicker )
420
+ if( options.datepicker )
421
+ datepicker.addClass('active');
422
+ else
367
423
  datepicker.removeClass('active');
368
-
369
- if( options.datepicker && !options.timepicker )
424
+
425
+ if( options.timepicker )
426
+ timepicker.addClass('active');
427
+ else
370
428
  timepicker.removeClass('active');
371
429
 
372
430
  if( options.value ){
@@ -381,17 +439,15 @@
381
439
 
382
440
  if( !options.timepickerScrollbar )
383
441
  scrollbar.hide();
384
-
385
- var tmpDate = [],timeOffset;
386
- if( options.minDate && ( tmpDate = /^-(.*)$/.exec(options.minDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ) {
387
- timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
388
- options.minDate = new Date((_xdsoft_datetime.now()).getTime()-timeOffset).dateFormat( options.formatDate );
442
+
443
+ if( options.minDate && /^-(.*)$/.test(options.minDate) ){
444
+ options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat( options.formatDate );
389
445
  }
390
- if( options.maxDate && ( tmpDate = /^\+(.*)$/.exec(options.maxDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ) {
391
- timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
392
- options.maxDate = new Date((_xdsoft_datetime.now()).getTime()+timeOffset).dateFormat( options.formatDate );
446
+
447
+ if( options.maxDate && /^\+(.*)$/.test(options.maxDate) ) {
448
+ options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat( options.formatDate );
393
449
  }
394
-
450
+
395
451
  mounth_picker
396
452
  .find('.xdsoft_today_button')
397
453
  .css('visibility',!options.todayButton?'hidden':'visible');
@@ -439,8 +495,7 @@
439
495
  input.off('keydown.xdsoft');
440
496
  switch(true) {
441
497
  case ( options.mask===true ):
442
- //options.mask = (new Date()).dateFormat( options.format );
443
- //options.mask = options.mask.replace(/[0-9]/g,'_');
498
+
444
499
  options.mask = options.format
445
500
  .replace(/Y/g,'9999')
446
501
  .replace(/F/g,'9999')
@@ -449,34 +504,41 @@
449
504
  .replace(/H/g,'29')
450
505
  .replace(/i/g,'59')
451
506
  .replace(/s/g,'59');
507
+
452
508
  case ( $.type(options.mask) == 'string' ):
509
+
453
510
  if( !isValidValue( options.mask,input.val() ) )
454
511
  input.val(options.mask.replace(/[0-9]/g,'_'));
455
512
 
456
513
  input.on('keydown.xdsoft',function( event ) {
457
514
  var val = this.value,
458
515
  key = event.which;
516
+
459
517
  switch(true) {
460
518
  case (( key>=KEY0&&key<=KEY9 )||( key>=_KEY0&&key<=_KEY9 ))||(key==BACKSPACE||key==DEL):
461
519
  var pos = getCaretPos(this),
462
520
  digit = ( key!=BACKSPACE&&key!=DEL )?String.fromCharCode((_KEY0 <= key && key <= _KEY9)? key-KEY0 : key):'_';
521
+
463
522
  if( (key==BACKSPACE||key==DEL)&&pos ) {
464
523
  pos--;
465
524
  digit='_';
466
525
  }
526
+
467
527
  while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
468
528
  pos+=( key==BACKSPACE||key==DEL )?-1:1;
469
529
 
470
530
  val = val.substr(0,pos)+digit+val.substr(pos+1);
471
- if( $.trim(val)=='' )
531
+ if( $.trim(val)=='' ){
472
532
  val = options.mask.replace(/[0-9]/g,'_');
473
- else
533
+ }else{
474
534
  if( pos==options.mask.length )
475
535
  break;
476
-
536
+ }
537
+
477
538
  pos+=(key==BACKSPACE||key==DEL)?0:1;
478
539
  while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
479
540
  pos+=(key==BACKSPACE||key==DEL)?-1:1;
541
+
480
542
  if( isValidValue( options.mask,val ) ) {
481
543
  this.value = val;
482
544
  setCaretPos(this,pos);
@@ -566,7 +628,7 @@
566
628
  };
567
629
 
568
630
  _this.setCurrentTime = function( dTime) {
569
- _this.currentTime = (typeof dTime == 'string')? _this.strtodatetime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now();
631
+ _this.currentTime = (typeof dTime == 'string')? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now();
570
632
  datetimepicker.trigger('xchange.xdsoft');
571
633
  };
572
634
 
@@ -614,10 +676,18 @@
614
676
  return month;
615
677
  };
616
678
 
617
- _this.strtodatetime = function( sDateTime ) {
618
- var currentTime = sDateTime?Date.parseDate(sDateTime, options.format):_this.now();
679
+ _this.strToDateTime = function( sDateTime ) {
680
+ var tmpDate = [],timeOffset,currentTime;
681
+
682
+ if( ( tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime) ) && ( tmpDate[2]=Date.parseDate(tmpDate[2], options.formatDate) ) ) {
683
+ timeOffset = tmpDate[2].getTime()-1*(tmpDate[2].getTimezoneOffset())*60000;
684
+ currentTime = new Date((_xdsoft_datetime.now()).getTime()+parseInt(tmpDate[1]+'1')*timeOffset);
685
+ }else
686
+ currentTime = sDateTime?Date.parseDate(sDateTime, options.format):_this.now();
687
+
619
688
  if( !_this.isValidDate(currentTime) )
620
689
  currentTime = _this.now();
690
+
621
691
  return currentTime;
622
692
  };
623
693
 
@@ -705,9 +775,10 @@
705
775
  datetimepicker
706
776
  .on('xchange.xdsoft',function( event ) {
707
777
  var table = '',
708
- start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1),
778
+ start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1, 12, 0, 0),
709
779
  i = 0,
710
780
  today = _xdsoft_datetime.now();
781
+
711
782
  while( start.getDay()!=options.dayOfWeekStart )
712
783
  start.setDate(start.getDate()-1);
713
784
 
@@ -722,15 +793,19 @@
722
793
  table+='</tr></thead>';
723
794
  table+='<tbody><tr>';
724
795
  var maxDate = false, minDate = false;
796
+
725
797
  if( options.maxDate!==false ) {
726
798
  maxDate = _xdsoft_datetime.strtodate(options.maxDate);
727
799
  maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate(),23,59,59,999);
728
800
  }
801
+
729
802
  if( options.minDate!==false ) {
730
803
  minDate = _xdsoft_datetime.strtodate(options.minDate);
731
804
  minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
732
805
  }
806
+
733
807
  var d,y,m,classes = [];
808
+
734
809
  while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
735
810
  classes = [];
736
811
  i++;
@@ -788,8 +863,13 @@
788
863
  classes = [];
789
864
  if( (options.maxTime!==false&&_xdsoft_datetime.strtotime(options.maxTime).getTime()<now.getTime())||(options.minTime!==false&&_xdsoft_datetime.strtotime(options.minTime).getTime()>now.getTime()))
790
865
  classes.push('xdsoft_disabled');
791
- if( (options.defaultSelect||datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)&&(options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m)))
792
- classes.push('xdsoft_current');
866
+ if( (options.initTime||options.defaultSelect||datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)&&(options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m))) {
867
+ if( options.defaultSelect||datetimepicker.data('changed')) {
868
+ classes.push('xdsoft_current');
869
+ } else if( options.initTime ) {
870
+ classes.push('xdsoft_init_time');
871
+ }
872
+ }
793
873
  if( parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))
794
874
  classes.push('xdsoft_today');
795
875
  time+= '<div class="xdsoft_time '+classes.join(' ')+'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
@@ -830,16 +910,26 @@
830
910
  event.stopPropagation();
831
911
  })
832
912
  .on('afterOpen.xdsoft',function() {
833
- if( options.timepicker && timebox.find('.xdsoft_current').length ) {
834
- var pheight = timeboxparent[0].clientHeight,
835
- height = timebox[0].offsetHeight,
836
- top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
837
- if( (height-pheight)<top )
838
- top = height-pheight;
839
- timebox.css('marginTop','-'+parseInt(top)+'px');
840
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[parseInt(top)/(height-pheight)]);
913
+ if( options.timepicker ) {
914
+ var classType;
915
+ if( timebox.find('.xdsoft_current').length ) {
916
+ classType = '.xdsoft_current';
917
+ } else if( timebox.find('.xdsoft_init_time').length ) {
918
+ classType = '.xdsoft_init_time';
919
+ }
920
+
921
+ if( classType ) {
922
+ var pheight = timeboxparent[0].clientHeight,
923
+ height = timebox[0].offsetHeight,
924
+ top = timebox.find(classType).index()*options.timeHeightInTimePicker+1;
925
+ if( (height-pheight)<top )
926
+ top = height-pheight;
927
+ timebox.css('marginTop','-'+parseInt(top)+'px');
928
+ timeboxparent.trigger('scroll_element.xdsoft_scroller',[parseInt(top)/(height-pheight)]);
929
+ }
841
930
  }
842
931
  });
932
+
843
933
  var timerclick = 0;
844
934
  calendar
845
935
  .on('click.xdsoft','td',function() {
@@ -850,8 +940,8 @@
850
940
  return false;
851
941
 
852
942
  currentTime.setFullYear( $this.data('year') );
853
- currentTime.setDate( $this.data('date') );
854
943
  currentTime.setMonth( $this.data('month') );
944
+ currentTime.setDate( $this.data('date') );
855
945
  datetimepicker.trigger('select.xdsoft',[currentTime]);
856
946
 
857
947
  input.val( _xdsoft_datetime.str() );
@@ -924,8 +1014,11 @@
924
1014
 
925
1015
  datetimepicker
926
1016
  .on('changedatetime.xdsoft',function() {
927
- if( options.onChangeDateTime&&options.onChangeDateTime.call )
928
- options.onChangeDateTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1017
+ if( options.onChangeDateTime&&options.onChangeDateTime.call ) {
1018
+ var $input = datetimepicker.data('input');
1019
+ options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input);
1020
+ $input.trigger('change');
1021
+ }
929
1022
  })
930
1023
  .on('generate.xdsoft',function() {
931
1024
  if( options.onGenerate&&options.onGenerate.call )
@@ -953,6 +1046,8 @@
953
1046
  var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1, left = offset.left;
954
1047
  if( top+datetimepicker[0].offsetHeight>$(window).height()+$(window).scrollTop() )
955
1048
  top = offset.top-datetimepicker[0].offsetHeight+1;
1049
+ if (top < 0)
1050
+ top = 0;
956
1051
  if( left+datetimepicker[0].offsetWidth>$(window).width() )
957
1052
  left = offset.left-datetimepicker[0].offsetWidth+datetimepicker.data('input')[0].offsetWidth;
958
1053
  datetimepicker.css({
@@ -999,14 +1094,23 @@
999
1094
 
1000
1095
  datetimepicker.data('xdsoft_datetime',_xdsoft_datetime);
1001
1096
  datetimepicker.setOptions(options);
1002
-
1003
- var ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';
1004
- if( ct && _xdsoft_datetime.isValidDate(ct = Date.parseDate(ct, options.format)) ) {
1005
- datetimepicker.data('changed',true);
1006
- }else
1007
- ct = '';
1008
-
1009
- _xdsoft_datetime.setCurrentTime( ct?ct:0 );
1097
+
1098
+ function getCurrentValue(){
1099
+ var ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';
1100
+
1101
+ if( ct && _xdsoft_datetime.isValidDate(ct = Date.parseDate(ct, options.format)) ) {
1102
+ datetimepicker.data('changed',true);
1103
+ }else
1104
+ ct = '';
1105
+
1106
+ if( !ct && options.startDate!==false ){
1107
+ ct = _xdsoft_datetime.strToDateTime(options.startDate);
1108
+ }
1109
+
1110
+ return ct?ct:0;
1111
+ }
1112
+
1113
+ _xdsoft_datetime.setCurrentTime( getCurrentValue() );
1010
1114
 
1011
1115
  datetimepicker.trigger('afterOpen.xdsoft');
1012
1116
 
@@ -1019,7 +1123,8 @@
1019
1123
  timer = setTimeout(function() {
1020
1124
  if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') )
1021
1125
  return;
1022
- _xdsoft_datetime.setCurrentTime((input&&input.val&&input.val())?input.val():0);
1126
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
1127
+
1023
1128
  datetimepicker.trigger('open.xdsoft');
1024
1129
  },100);
1025
1130
  })
@@ -1107,8 +1212,7 @@
1107
1212
  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
1108
1213
  * details.
1109
1214
  */
1110
- Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(format) {if(Date.formatFunctions[format]==null) {Date.createNewFormat(format)}var func=Date.formatFunctions[format];return this[func]()};Date.createNewFormat=function(format) {var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function() {return ";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)}}eval(code.substring(0,code.length-3)+";}")};Date.getFormatCode=function(character) {switch(character) {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(character)+"' + "}};Date.parseDate=function(input,format) {if(Date.parseFunctions[format]==null) {Date.createParser(format)}var func=Date.parseFunctions[format];return Date[func](input)};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) {\n"+"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n"+"var d = new Date();\n"+"y = d.getFullYear();\n"+"m = d.getMonth();\n"+"d = d.getDate();\n"+"var results = input.match(Date.parseRegexes["+regexNum+"]);\n"+"if (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 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{return new Date(y, m, d, h, i, s);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{return new Date(y, m, d, h, i);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n"+"{return new Date(y, m, d, h);}\n"+"else if (y > 0 && m >= 0 && d > 0)\n"+"{return new Date(y, m, d);}\n"+"else if (y > 0 && m >= 0)\n"+"{return new Date(y, m);}\n"+"else if (y > 0)\n"+"{return new Date(y);}\n"+"}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code)};Date.formatCodeToRegex=function(character,currentGroup) {switch(character) {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["+currentGroup+"], 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:0,c:null,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["+currentGroup+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+currentGroup+"]], 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["+currentGroup+"], 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["+currentGroup+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+currentGroup+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+currentGroup+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+currentGroup+"] == 'AM') {\n"+"if (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["+currentGroup+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+currentGroup+"], 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(character)}}};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 num=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i) {num+=Date.daysInMonth[i]}return num+this.getDate()-1};Date.prototype.getWeekOfYear=function() {var now=this.getDayOfYear()+(4-this.getDay());var jan1=new Date(this.getFullYear(),0,1);var then=(7-jan1.getDay()+4);document.write(then);return String.leftPad(((now-then)/7)+1,2,"0")};Date.prototype.isLeapYear=function() {var year=this.getFullYear();return((year&3)==0&&(year%100||(year%400==0&&year)))};Date.prototype.getFirstDayOfMonth=function() {var day=(this.getDay()-(this.getDate()-1))%7;return(day<0)?(day+7):day};Date.prototype.getLastDayOfMonth=function() {var day=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(day<0)?(day+7):day};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(string) {return string.replace(/('|\\)/g,"\\$1")};String.leftPad=function(val,size,ch) {var result=new String(val);if(ch==null) {ch=" "}while(result.length<size) {result=ch+result}return result};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"};
1111
-
1215
+ Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(format){if(format=='unixtime')return parseInt(this.getTime()/1000);if(Date.formatFunctions[format]==null){Date.createNewFormat(format)}var func=Date.formatFunctions[format];return this[func]()};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function() {return ";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)}}eval(code.substring(0,code.length-3)+";}")};Date.getFormatCode=function(character){switch(character){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(character)+"' + "}};Date.parseDate=function(input,format){if(format=='unixtime')return new Date(!isNaN(parseInt(input))?parseInt(input)*1000:0);if(Date.parseFunctions[format]==null){Date.createParser(format)}var func=Date.parseFunctions[format];return Date[func](input)};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) {\n"+"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n"+"var d = new Date();\n"+"y = d.getFullYear();\n"+"m = d.getMonth();\n"+"d = d.getDate();\n"+"var results = input.match(Date.parseRegexes["+regexNum+"]);\n"+"if (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 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{return new Date(y, m, d, h, i, s);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{return new Date(y, m, d, h, i);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n"+"{return new Date(y, m, d, h);}\n"+"else if (y > 0 && m >= 0 && d > 0)\n"+"{return new Date(y, m, d);}\n"+"else if (y > 0 && m >= 0)\n"+"{return new Date(y, m);}\n"+"else if (y > 0)\n"+"{return new Date(y);}\n"+"}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code)};Date.formatCodeToRegex=function(character,currentGroup){switch(character){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["+currentGroup+"], 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:0,c:null,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["+currentGroup+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+currentGroup+"]], 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["+currentGroup+"], 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["+currentGroup+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+currentGroup+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+currentGroup+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+currentGroup+"] == 'AM') {\n"+"if (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["+currentGroup+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+currentGroup+"], 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(character)}}};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 num=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i){num+=Date.daysInMonth[i]}return num+this.getDate()-1};Date.prototype.getWeekOfYear=function(){var now=this.getDayOfYear()+(4-this.getDay());var jan1=new Date(this.getFullYear(),0,1);var then=(7-jan1.getDay()+4);document.write(then);return String.leftPad(((now-then)/7)+1,2,"0")};Date.prototype.isLeapYear=function(){var year=this.getFullYear();return((year&3)==0&&(year%100||(year%400==0&&year)))};Date.prototype.getFirstDayOfMonth=function(){var day=(this.getDay()-(this.getDate()-1))%7;return(day<0)?(day+7):day};Date.prototype.getLastDayOfMonth=function(){var day=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(day<0)?(day+7):day};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(string){return string.replace(/('|\\)/g,"\\$1")};String.leftPad=function(val,size,ch){var result=new String(val);if(ch==null){ch=" "}while(result.length<size){result=ch+result}return result};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"};
1112
1216
  //https://github.com/brandonaaron/jquery-mousewheel/blob/master/jquery.mousewheel.js
1113
1217
  /*
1114
1218
  * Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Datetimepicker
3
3
  module Rails
4
- VERSION = '2.1.9.0'
4
+ VERSION = '2.2.2.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-datetimepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.9.0
4
+ version: 2.2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-10 00:00:00.000000000 Z
11
+ date: 2014-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: A date and time picker for jQuery and Rails
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
48
+ - .gitignore
49
49
  - Gemfile
50
50
  - LICENSE.txt
51
51
  - README.md
@@ -66,17 +66,17 @@ require_paths:
66
66
  - lib
67
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ">="
69
+ - - '>='
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">="
74
+ - - '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.2.1
79
+ rubygems_version: 2.2.2
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: This gem packages the datetimepicker jQuery plugin for Rails 3.1+ asset pipeline