jquery-datetimepicker-rails 2.1.4.0 → 2.1.5.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: 2a5e5f6ba162ed0f0656206607e29f3dd41da629
4
- data.tar.gz: b9bd6f2be2f44ae75adcd703fe874d59668f082b
3
+ metadata.gz: ca85fef2592716923d0f555d68726afdafe456e7
4
+ data.tar.gz: a0c04b13aa8bca9a6429f7fc6247940fdc26cd2c
5
5
  SHA512:
6
- metadata.gz: 4fd57f043caba087ef517b696eb6dfd457e97dea1f25612208216dbbaafe9017752327449fd1da630c48bb946a9bedee97f69c29470bf84c14cefcab83d96057
7
- data.tar.gz: 793475b5187377caf29b75051b4511b49fe69be7be8df65353c7375a8273cd0b91e79ec0cfb5559e422a9ffa670b80fc189259bc2b4dd9d4f96451103a2a9852
6
+ metadata.gz: e811f06bda0a517e0546f0a7d38a5fa5810d9f0ca4af5987308fbddbd9767515ec693f9d90905c3ac8d22aae89035714ec06f01351747104da7815a416fdfbf5
7
+ data.tar.gz: 3cd23429aed838e64a666fe0e4e1e1131c8abc9a40ad214e1897fea3bdd7ef088a2fbb02bd8a57e590fa81d85177f0344864fe9cd17f4a594cccdfa9ec1ca00e
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.1.4
2
+ * @preserve jQuery DateTimePicker plugin v2.1.5
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
- * (c) 2013, Chupurnov Valeriy.
4
+ * (c) 2014, Chupurnov Valeriy.
5
5
  */
6
6
  (function( $ ) {
7
7
  'use strict'
8
8
  var default_options = {
9
9
  i18n:{
10
- ru:{
10
+ ru:{ // Russian
11
11
  months:[
12
12
  'Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'
13
13
  ],
@@ -15,7 +15,7 @@
15
15
  "Вск", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
16
16
  ]
17
17
  },
18
- en:{
18
+ en:{ // English
19
19
  months: [
20
20
  "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
21
21
  ],
@@ -23,7 +23,7 @@
23
23
  "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
24
24
  ]
25
25
  },
26
- de:{
26
+ de:{ // German
27
27
  months:[
28
28
  'Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'
29
29
  ],
@@ -31,7 +31,7 @@
31
31
  "So.", "Mo", "Di", "Mi", "Do", "Fr", "Sa."
32
32
  ]
33
33
  },
34
- nl:{
34
+ nl:{ // Dutch
35
35
  months:[
36
36
  "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
37
37
  ],
@@ -39,7 +39,7 @@
39
39
  "zo", "ma", "di", "wo", "do", "vr", "za"
40
40
  ]
41
41
  },
42
- tr:{
42
+ tr:{ // Turkish
43
43
  months:[
44
44
  "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
45
45
  ],
@@ -47,7 +47,7 @@
47
47
  "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
48
48
  ]
49
49
  },
50
- fr:{
50
+ fr:{ //French
51
51
  months:[
52
52
  "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
53
53
  ],
@@ -55,13 +55,21 @@
55
55
  "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
56
56
  ]
57
57
  },
58
- es:{
58
+ es:{ // Spanish
59
59
  months: [
60
60
  "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
61
61
  ],
62
62
  dayOfWeek: [
63
63
  "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
64
64
  ]
65
+ },
66
+ th:{ // Thai
67
+ months:[
68
+ 'มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'
69
+ ],
70
+ dayOfWeek:[
71
+ 'อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'
72
+ ]
65
73
  }
66
74
  },
67
75
  value:'',
@@ -110,17 +118,18 @@
110
118
  id:'',
111
119
  roundTime:'round', // ceil, floor
112
120
  className:'',
113
- weekends : []
121
+ weekends : [],
122
+ yearOffset:0
114
123
  };
115
124
  // fix for ie8
116
- if (!Array.prototype.indexOf) {
125
+ if ( !Array.prototype.indexOf ) {
117
126
  Array.prototype.indexOf = function(obj, start) {
118
127
  for (var i = (start || 0), j = this.length; i < j; i++) {
119
128
  if (this[i] === obj) { return i; }
120
129
  }
121
130
  return -1;
122
131
  }
123
- }
132
+ };
124
133
  $.fn.xdsoftScroller = function( _percent ) {
125
134
  return this.each(function() {
126
135
  var timeboxparent = $(this);
@@ -188,7 +197,7 @@
188
197
  maximumOffset = scrollbar[0].offsetHeight-scroller[0].offsetHeight;
189
198
  timeboxparent.trigger('scroll_element.xdsoft_scroller',[_percent?_percent:Math.abs(parseInt(timebox.css('marginTop')))/(height-parentHeight)]);
190
199
  }
191
- })
200
+ });
192
201
  timeboxparent.mousewheel&&timeboxparent.mousewheel(function(event, delta, deltaX, deltaY) {
193
202
  var top = Math.abs(parseInt(timebox.css('marginTop')));
194
203
  timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-delta*20)/(height-parentHeight)]);
@@ -339,11 +348,11 @@
339
348
  var tmpDate = [],timeOffset;
340
349
  if( options.minDate && ( tmpDate = /^-(.*)$/.exec(options.minDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ) {
341
350
  timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
342
- options.minDate = new Date((new Date).getTime()-timeOffset).dateFormat( options.formatDate );
351
+ options.minDate = new Date((_xdsoft_datetime.now()).getTime()-timeOffset).dateFormat( options.formatDate );
343
352
  }
344
353
  if( options.maxDate && ( tmpDate = /^\+(.*)$/.exec(options.maxDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ) {
345
354
  timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
346
- options.maxDate = new Date((new Date).getTime()+timeOffset).dateFormat( options.formatDate );
355
+ options.maxDate = new Date((_xdsoft_datetime.now()).getTime()+timeOffset).dateFormat( options.formatDate );
347
356
  }
348
357
 
349
358
  mounth_picker
@@ -458,7 +467,7 @@
458
467
  $(this).val(null);
459
468
  datetimepicker.data('xdsoft_datetime').empty();
460
469
  }else if( !Date.parseDate( $(this).val(), options.format ) ) {
461
- $(this).val((new Date()).dateFormat( options.format ));
470
+ $(this).val((_xdsoft_datetime.now()).dateFormat( options.format ));
462
471
  datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
463
472
  }
464
473
  else{
@@ -506,7 +515,10 @@
506
515
  var _xdsoft_datetime = new function() {
507
516
  var _this = this;
508
517
  _this.now = function() {
509
- return new Date();
518
+ var d = new Date();
519
+ if( options.yearOffset )
520
+ d.setFullYear(d.getFullYear()+options.yearOffset);
521
+ return d;
510
522
  };
511
523
 
512
524
  _this.currentTime = this.now();
@@ -554,23 +566,23 @@
554
566
  };
555
567
 
556
568
  _this.strtodatetime = function( sDateTime ) {
557
- var currentTime = sDateTime?Date.parseDate(sDateTime, options.format):new Date;
569
+ var currentTime = sDateTime?Date.parseDate(sDateTime, options.format):_this.now();
558
570
  if( !_this.isValidDate(currentTime) )
559
- currentTime = new Date;
571
+ currentTime = _this.now();
560
572
  return currentTime;
561
573
  };
562
574
 
563
575
  _this.strtodate = function( sDate ) {
564
- var currentTime = sDate?Date.parseDate(sDate, options.formatDate):new Date;
576
+ var currentTime = sDate?Date.parseDate(sDate, options.formatDate):_this.now();
565
577
  if( !_this.isValidDate(currentTime) )
566
- currentTime = new Date;
578
+ currentTime = _this.now();
567
579
  return currentTime;
568
580
  };
569
581
 
570
582
  _this.strtotime = function( sTime ) {
571
- var currentTime = sTime?Date.parseDate(sTime, options.formatTime):new Date;
583
+ var currentTime = sTime?Date.parseDate(sTime, options.formatTime):_this.now();
572
584
  if( !_this.isValidDate(currentTime) )
573
- currentTime = new Date;
585
+ currentTime = _this.now();
574
586
  return currentTime;
575
587
  };
576
588
 
@@ -582,7 +594,7 @@
582
594
  .find('.xdsoft_today_button')
583
595
  .on('mousedown.xdsoft',function() {
584
596
  datetimepicker.data('changed',true);
585
- _xdsoft_datetime.setCurrentTime(new Date);
597
+ _xdsoft_datetime.setCurrentTime(0);
586
598
  datetimepicker.trigger('afterOpen.xdsoft');
587
599
  }).on('dblclick.xdsoft',function(){
588
600
  input.val( _xdsoft_datetime.str() );
@@ -646,7 +658,7 @@
646
658
  var table = '',
647
659
  start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1),
648
660
  i = 0,
649
- today = new Date;
661
+ today = _xdsoft_datetime.now();
650
662
  while( start.getDay()!=options.dayOfWeekStart )
651
663
  start.setDate(start.getDate()-1);
652
664
 
@@ -718,7 +730,7 @@
718
730
  h = '',
719
731
  m ='',
720
732
  line_time = function line_time( h,m ) {
721
- var now = new Date();
733
+ var now = _xdsoft_datetime.now();
722
734
  now.setHours(h);
723
735
  h = parseInt(now.getHours());
724
736
  now.setMinutes(m);
@@ -755,7 +767,7 @@
755
767
  var opt = '',
756
768
  i = 0;
757
769
 
758
- for( i = parseInt(options.yearStart,10);i<= parseInt(options.yearEnd,10);i++ ) {
770
+ for( i = parseInt(options.yearStart,10)+options.yearOffset;i<= parseInt(options.yearEnd,10)+options.yearOffset;i++ ) {
759
771
  opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>';
760
772
  }
761
773
  yearselect.children().eq(0)
@@ -945,7 +957,7 @@
945
957
  }else
946
958
  ct = '';
947
959
 
948
- _xdsoft_datetime.setCurrentTime( ct?ct:new Date );
960
+ _xdsoft_datetime.setCurrentTime( ct?ct:0 );
949
961
 
950
962
  datetimepicker.trigger('afterOpen.xdsoft');
951
963
 
@@ -958,7 +970,7 @@
958
970
  timer = setTimeout(function() {
959
971
  if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') )
960
972
  return;
961
- _xdsoft_datetime.setCurrentTime((input&&input.val&&input.val())?input.val():new Date);
973
+ _xdsoft_datetime.setCurrentTime((input&&input.val&&input.val())?input.val():0);
962
974
  datetimepicker.trigger('open.xdsoft');
963
975
  },100);
964
976
  })
@@ -1030,7 +1042,7 @@
1030
1042
  }
1031
1043
  }else{
1032
1044
  datetimepicker
1033
- .setOptions(options);
1045
+ .setOptions(opt);
1034
1046
  }
1035
1047
  return 0;
1036
1048
  }else
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Datetimepicker
3
3
  module Rails
4
- VERSION = '2.1.4.0'
4
+ VERSION = '2.1.5.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-datetimepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4.0
4
+ version: 2.1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov