jQuery(document).ready(function($) { jQuery.datepicker.regional['de'] = {clearText: 'löschen', clearStatus: 'aktuelles Datum löschen', closeText: 'schließen', closeStatus: 'ohne Änderungen schließen', prevText: '', nextStatus: 'nächsten Monat zeigen', currentText: 'heute', currentStatus: '', monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'], monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'], monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen', weekHeader: 'Wo', weekStatus: 'Woche des Monats', dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d', dateFormat: 'dd.mm.yy', firstDay: 1, initStatus: 'Wähle ein Datum', isRTL: false}; jQuery.datepicker.setDefaults(jQuery.datepicker.regional['de']); var now = new Date(); var today = new Date( now.getFullYear(), now.getMonth(), now.getDate() ); var dateFormat = "dd.mm.yy"; var from = $( "#startdatum" ) .datepicker({ defaultDate: "+1w", changeMonth: true, numberOfMonths: 1, dateFormat : 'dd.mm.yy', minDate: today, beforeShow: function() { setTimeout(function(){ $('.ui-datepicker').css('z-index', 40); }, 0) } }) .on( "change", function() { to.datepicker( "option", "minDate", getMinDate( this ) ); }); var to = $( "#enddatum" ).datepicker({ defaultDate: "+1w", changeMonth: true, numberOfMonths: 1, dateFormat : 'dd.mm.yy', minDate: today, beforeShow: function() { setTimeout(function(){ $('.ui-datepicker').css('z-index', 40); }, 0) } }) .on( "change", function() { from.datepicker( "option", "maxDate", getMaxDate( this ) ); }); function getMinDate( element ) { var date; var today = new Date(); try { date = jQuery.datepicker.parseDate( dateFormat, element.value ); } catch( error ) { date = today; } if(date < today){ date = today; } return date; } function getMaxDate( element ) { var date; //var today = new Date(); var tomorrow = new Date(); tomorrow.setDate(tomorrow.getDate() + 1); try { date = jQuery.datepicker.parseDate( dateFormat, element.value ); } catch( error ) { date = tomorrow; } if(date < tomorrow){ date = tomorrow; } return date; } $('#dateSubmit').bind('click', function(event){ event.preventDefault(); $('#filterform').submit(); }); // $('.date_picker').datepicker({ // dateFormat : 'dd.mm.yy' // }); }); //end jQuery-Block