Skip to content

Commit

Permalink
Update to 2.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
shekibobo committed Aug 1, 2014
1 parent 8ebc4a7 commit 66fd81f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
47 changes: 33 additions & 14 deletions app/assets/javascripts/jquery.xdan.datetimepicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @preserve jQuery DateTimePicker plugin v2.3.1
* @preserve jQuery DateTimePicker plugin v2.3.2
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* (c) 2014, Chupurnov Valeriy.
*/
Expand Down Expand Up @@ -217,7 +217,10 @@

timepicker:true,
datepicker:true,


defaultTime:false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
defaultDate:false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')

minDate:false,
maxDate:false,
minTime:false,
Expand Down Expand Up @@ -730,21 +733,37 @@

var _xdsoft_datetime = new function() {
var _this = this;
_this.now = function() {
_this.now = function( norecursion ) {
var d = new Date();
if( options.yearOffset )

if( !norecursion && options.defaultDate ){
var date = _this.strtodate(options.defaultDate);
d.setFullYear( date.getFullYear() );
d.setMonth( date.getMonth() );
d.setDate( date.getDate() );
}

if( options.yearOffset ){
d.setFullYear(d.getFullYear()+options.yearOffset);
}

if( !norecursion && options.defaultTime ){
var time = _this.strtotime(options.defaultTime);
d.setHours( time.getHours() );
d.setMinutes( time.getMinutes() );
}

return d;
};

_this.currentTime = this.now();

_this.isValidDate = function (d) {
if ( Object.prototype.toString.call(d) !== "[object Date]" )
return false;
return !isNaN(d.getTime());
};

_this.setCurrentTime = function( dTime) {
_this.setCurrentTime = function( dTime ) {
_this.currentTime = (typeof dTime == 'string')? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now();
datetimepicker.trigger('xchange.xdsoft');
};
Expand Down Expand Up @@ -815,9 +834,9 @@
if( sDate && sDate instanceof Date && _this.isValidDate(sDate) )
return sDate;

var currentTime = sDate?Date.parseDate(sDate, options.formatDate):_this.now();
var currentTime = sDate?Date.parseDate(sDate, options.formatDate):_this.now(true);
if( !_this.isValidDate(currentTime) )
currentTime = _this.now();
currentTime = _this.now(true);

return currentTime;
};
Expand All @@ -828,14 +847,16 @@

var currentTime = sTime?Date.parseDate(sTime, options.formatTime):_this.now();
if( !_this.isValidDate(currentTime) )
currentTime = _this.now();
currentTime = _this.now(true);

return currentTime;
};

_this.str = function() {
return _this.currentTime.dateFormat(options.format);
};

_this.currentTime = this.now();
};
mounth_picker
.find('.xdsoft_today_button')
Expand Down Expand Up @@ -1281,11 +1302,9 @@

var ct = false;

if (options.startDate instanceof Date && !isNaN(options.startDate.valueOf())) {
ct = options.startDate;
} else if (!ct && options.startDate!==false) {
if ( options.startDate ) {
ct = _xdsoft_datetime.strToDateTime(options.startDate);
} else if (!ct) {
} else {
ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';
ct = Date.parseDate(ct, options.format);
}
Expand All @@ -1298,7 +1317,7 @@

return ct?ct:0;
}

//debugger
_xdsoft_datetime.setCurrentTime( getCurrentValue() );

input
Expand Down
2 changes: 1 addition & 1 deletion lib/xdan-datetimepicker-rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module XdanDatetimepickerRails
VERSION = '2.3.1'
VERSION = '2.3.2'
end

0 comments on commit 66fd81f

Please sign in to comment.