xdan-datetimepicker-rails 2.3.1 → 2.3.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: 6832de300b368615a049e6e1e57462ac42ed11f5
4
- data.tar.gz: ff3f16180853551486fddb63359039a96974ea4a
3
+ metadata.gz: fb3ff2ef786152c733ee11b40ae2e28bcd8fed52
4
+ data.tar.gz: 2f115008386c18b1e1cd887e2234876c84eeb494
5
5
  SHA512:
6
- metadata.gz: 9a9a7f340229a1f1b54375a97ad6f3c2dc08cb4a0d8245dbee9f58fd558377b61d7c8faf647d788db68345e2826f70f8de086c67689d28b2737c693c618dae1c
7
- data.tar.gz: 129cf6d773a19ad54e8c9c502abf8e6867de5c4e1c8b23068f3bb4dcbe05cab02b0cdb761923a1b4976c12d402c90f9c3b2e1bc7951a99267c4dd3756713987f
6
+ metadata.gz: 4e59ef21760bceef040114fca198eab8edb924c180bbf8d8c87dff9b72809bc71bbb2a370e20c5e75191170581f71e01844f84487eb46689434258beee11c5d3
7
+ data.tar.gz: 26ec39e4f2979995c577472e460aacb5f320dd029854ad8e428af4d8fffbb60a7b3133d7a467568616b6f99a9dd41416ac6e5a995b40d6cef12b7b054fa2d1ef
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.3.1
2
+ * @preserve jQuery DateTimePicker plugin v2.3.2
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
4
  * (c) 2014, Chupurnov Valeriy.
5
5
  */
@@ -217,7 +217,10 @@
217
217
 
218
218
  timepicker:true,
219
219
  datepicker:true,
220
-
220
+
221
+ defaultTime:false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
222
+ defaultDate:false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
223
+
221
224
  minDate:false,
222
225
  maxDate:false,
223
226
  minTime:false,
@@ -730,21 +733,37 @@
730
733
 
731
734
  var _xdsoft_datetime = new function() {
732
735
  var _this = this;
733
- _this.now = function() {
736
+ _this.now = function( norecursion ) {
734
737
  var d = new Date();
735
- if( options.yearOffset )
738
+
739
+ if( !norecursion && options.defaultDate ){
740
+ var date = _this.strtodate(options.defaultDate);
741
+ d.setFullYear( date.getFullYear() );
742
+ d.setMonth( date.getMonth() );
743
+ d.setDate( date.getDate() );
744
+ }
745
+
746
+ if( options.yearOffset ){
736
747
  d.setFullYear(d.getFullYear()+options.yearOffset);
748
+ }
749
+
750
+ if( !norecursion && options.defaultTime ){
751
+ var time = _this.strtotime(options.defaultTime);
752
+ d.setHours( time.getHours() );
753
+ d.setMinutes( time.getMinutes() );
754
+ }
755
+
737
756
  return d;
738
757
  };
739
758
 
740
- _this.currentTime = this.now();
759
+
741
760
  _this.isValidDate = function (d) {
742
761
  if ( Object.prototype.toString.call(d) !== "[object Date]" )
743
762
  return false;
744
763
  return !isNaN(d.getTime());
745
764
  };
746
765
 
747
- _this.setCurrentTime = function( dTime) {
766
+ _this.setCurrentTime = function( dTime ) {
748
767
  _this.currentTime = (typeof dTime == 'string')? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now();
749
768
  datetimepicker.trigger('xchange.xdsoft');
750
769
  };
@@ -815,9 +834,9 @@
815
834
  if( sDate && sDate instanceof Date && _this.isValidDate(sDate) )
816
835
  return sDate;
817
836
 
818
- var currentTime = sDate?Date.parseDate(sDate, options.formatDate):_this.now();
837
+ var currentTime = sDate?Date.parseDate(sDate, options.formatDate):_this.now(true);
819
838
  if( !_this.isValidDate(currentTime) )
820
- currentTime = _this.now();
839
+ currentTime = _this.now(true);
821
840
 
822
841
  return currentTime;
823
842
  };
@@ -828,7 +847,7 @@
828
847
 
829
848
  var currentTime = sTime?Date.parseDate(sTime, options.formatTime):_this.now();
830
849
  if( !_this.isValidDate(currentTime) )
831
- currentTime = _this.now();
850
+ currentTime = _this.now(true);
832
851
 
833
852
  return currentTime;
834
853
  };
@@ -836,6 +855,8 @@
836
855
  _this.str = function() {
837
856
  return _this.currentTime.dateFormat(options.format);
838
857
  };
858
+
859
+ _this.currentTime = this.now();
839
860
  };
840
861
  mounth_picker
841
862
  .find('.xdsoft_today_button')
@@ -1281,11 +1302,9 @@
1281
1302
 
1282
1303
  var ct = false;
1283
1304
 
1284
- if (options.startDate instanceof Date && !isNaN(options.startDate.valueOf())) {
1285
- ct = options.startDate;
1286
- } else if (!ct && options.startDate!==false) {
1305
+ if ( options.startDate ) {
1287
1306
  ct = _xdsoft_datetime.strToDateTime(options.startDate);
1288
- } else if (!ct) {
1307
+ } else {
1289
1308
  ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';
1290
1309
  ct = Date.parseDate(ct, options.format);
1291
1310
  }
@@ -1298,7 +1317,7 @@
1298
1317
 
1299
1318
  return ct?ct:0;
1300
1319
  }
1301
-
1320
+ //debugger
1302
1321
  _xdsoft_datetime.setCurrentTime( getCurrentValue() );
1303
1322
 
1304
1323
  input
@@ -1,3 +1,3 @@
1
1
  module XdanDatetimepickerRails
2
- VERSION = '2.3.1'
2
+ VERSION = '2.3.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xdan-datetimepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Kovach