JourneyJoker/static/frontend/js/custom-date-picker.js
2021-10-28 09:26:17 +02:00

32 lines
No EOL
854 B
JavaScript

(function($) {
"use strict";
$.get("/api/getvars/").done(function(data) {
var date_format = data["date_format"];
console.log("this");
});
$('.dpd1').each(function() {
console.log("that");
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: "d.m.Y",
onRender: function(date) {
return ((date.valueOf() < mindate.valueOf()) || (date.valueOf() > maxdate.valueOf())) ? 'disabled' : '';
}
}).on('changeDate', function(ev) {
checkin.hide();
}).data('datepicker');
});
})(jQuery);