diff --git a/frontend/views.py b/frontend/views.py index 23f7142..f08d6c7 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -78,6 +78,6 @@ class LanguageChoiceView(View): class LocaleVariableView(View): def get(self, request, *args, **kwargs): variables = { - "date_format": get_format('SHORT_DATE_FORMAT', use_l10n=True) + "date_format": get_format('SHORT_DATE_FORMAT', use_l10n=True).replace("Y", "yyyy") } return JsonResponse(variables) diff --git a/static/frontend/js/custom-date-picker.js b/static/frontend/js/custom-date-picker.js index 5758a77..c56f0e6 100644 --- a/static/frontend/js/custom-date-picker.js +++ b/static/frontend/js/custom-date-picker.js @@ -2,16 +2,15 @@ "use strict"; - $.get("/api/getvars/").done(function(data) { - var date_format = data["date_format"]; - - console.log("this"); + var date_format = "d.m.yyyy"; + $.get("/api/getvars/").done(function(data) { + date_format = data["date_format"]; }); $('.dpd1').each(function() { - console.log("that"); + console.log(date_format); var mindate = new Date($(this).attr("data-mindate")); mindate = new Date(mindate.getFullYear(), mindate.getMonth(), mindate.getDate(), 0, 0, 0, 0) @@ -19,7 +18,7 @@ maxdate = new Date(maxdate.getFullYear(), maxdate.getMonth(), maxdate.getDate(), 0, 0, 0, 0) var checkin = $(this).datepicker({ - format: "d.m.Y", + format: date_format, onRender: function(date) { return ((date.valueOf() < mindate.valueOf()) || (date.valueOf() > maxdate.valueOf())) ? 'disabled' : ''; } @@ -29,4 +28,4 @@ }); -})(jQuery); \ No newline at end of file +})(jQuery);