JourneyJoker/static/frontend/js/custom-date-picker.js

24 lines
No EOL
704 B
JavaScript

(function($) {
"use strict";
$('.dpd1').each(function() {
var mindate = new Date($(this).attr("data-mindate"));
mindate = new Date(mindate.getFullYear(), mindate.getMonth(), mindate.getDate(), 0, 0, 0, 0)
var maxdate = new Date($(this).attr("data-maxdate"));
maxdate = new Date(maxdate.getFullYear(), maxdate.getMonth(), maxdate.getDate(), 0, 0, 0, 0)
var checkin = $(this).datepicker({
format: 'dd.mm.yyyy',
onRender: function(date) {
return ((date.valueOf() < mindate.valueOf()) || (date.valueOf() > maxdate.valueOf())) ? 'disabled' : '';
}
}).on('changeDate', function(ev) {
checkin.hide();
}).data('datepicker');
});
})(jQuery);