Skip to content

Commit

Permalink
Update to 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shekibobo committed Aug 1, 2014
1 parent db46ea2 commit fb48daa
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 17 deletions.
68 changes: 52 additions & 16 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.2.9
* @preserve jQuery DateTimePicker plugin v2.3.0
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* (c) 2014, Chupurnov Valeriy.
*/
Expand Down Expand Up @@ -151,6 +151,14 @@
"Søn", "Man", "Tir", "ons", "Tor", "Fre", "lør"
]
},
no:{ // Norwegian
months: [
"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
],
dayOfWeek: [
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
]
},
ja:{ // Japanese
months: [
"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
Expand Down Expand Up @@ -182,6 +190,14 @@
dayOfWeek: [
"Ne", "Po", "Út", "St", "Čt", "Pá", "So"
]
},
hu:{ // Hungarian
months: [
"Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
],
dayOfWeek: [
"Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
]
}
},
value:'',
Expand Down Expand Up @@ -256,7 +272,8 @@
className:'',

weekends : [],
yearOffset:0
yearOffset:0,
beforeShowDay: null
};

// fix for ie8
Expand Down Expand Up @@ -361,6 +378,7 @@
timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-(coord.y-start.y))/(height-parentHeight)]);
event.stopPropagation();
event.preventDefault();
start = pointerEventToXY(event);
}
});
timeboxparent.on('touchend touchcancel',function( event ) {
Expand Down Expand Up @@ -517,7 +535,7 @@
datepicker.addClass('active');
else
datepicker.removeClass('active');

if( options.timepicker )
timepicker.addClass('active');
else
Expand Down Expand Up @@ -776,6 +794,9 @@
};

_this.strToDateTime = function( sDateTime ) {
if( sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime) )
return sDateTime;

var tmpDate = [],timeOffset,currentTime;

if( ( tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime) ) && ( tmpDate[2]=Date.parseDate(tmpDate[2], options.formatDate) ) ) {
Expand Down Expand Up @@ -916,7 +937,7 @@
minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
}

var d,y,m,classes = [];
var d,y,m,classes = [],customDateSettings;

while( i<_xdsoft_datetime.currentTime.countDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
classes = [];
Expand All @@ -926,14 +947,22 @@

classes.push('xdsoft_date');

if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate ) ){
if ( options.beforeShowDay && options.beforeShowDay.call ) {
customDateSettings = options.beforeShowDay.call(datetimepicker, start);
} else {
customDateSettings = null;
}

if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate )||(customDateSettings && customDateSettings[0] === false) ){
classes.push('xdsoft_disabled');
}

if( _xdsoft_datetime.currentTime.getMonth()!=m ){
classes.push('xdsoft_other_month');
if ( customDateSettings && customDateSettings[1] != "" ) {
classes.push(customDateSettings[1]);
}

if( _xdsoft_datetime.currentTime.getMonth()!=m ) classes.push('xdsoft_other_month');

if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat( options.formatDate )==start.dateFormat( options.formatDate ) ) {
classes.push('xdsoft_current');
}
Expand Down Expand Up @@ -1237,16 +1266,23 @@
datetimepicker.setOptions(options);

function getCurrentValue(){
var ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';

if( ct && _xdsoft_datetime.isValidDate(ct = Date.parseDate(ct, options.format)) ) {

var ct = false;

if (options.startDate instanceof Date && !isNaN(options.startDate.valueOf())) {
ct = options.startDate;
} else if (!ct && options.startDate!==false) {
ct = _xdsoft_datetime.strToDateTime(options.startDate);
} else if (!ct) {
ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';
ct = Date.parseDate(ct, options.format);
}

if ( ct && _xdsoft_datetime.isValidDate(ct) ) {
datetimepicker.data('changed',true);
}else
ct = '';

if( !ct && options.startDate!==false ){
ct = _xdsoft_datetime.strToDateTime(options.startDate);
}
} else {
ct = '';
}

return ct?ct:0;
}
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.2.9'
VERSION = '2.3.0'
end

0 comments on commit fb48daa

Please sign in to comment.