Alexey K
Alexey K

Reputation: 6723

jquery datepicker not changing date format

My jquery datepicker shows date in default format instead of dd.mm.yy however it is set in code. What is wrong ?

  $(function() {
    $("#startdatepicker")
      .datepicker({ minDate: -1, maxDate: "" }, "option", "dateFormat", "dd.mm.yy");
    $("#enddatepicker").datepicker({
      onSelect: function() {
        $('#submit_button').removeClass("hidden");
        createDays();
      },
      minDate: -1,
      maxDate: "" }).attr('disabled', 'disabled');
      $("#startdatepicker").on("change", function() {
       $("#enddatepicker").datepicker("option", "minDate", $("#startdatepicker").datepicker("getDate")).removeAttr('disabled');
    });
   });

Upvotes: 0

Views: 145

Answers (1)

Musa
Musa

Reputation: 97672

You're calling the function incorrectly

Try

$("#startdatepicker")
  .datepicker({ minDate: -1, maxDate: "", "dateFormat": "dd.mm.yy"});

or

$("#startdatepicker")
  .datepicker({ minDate: -1, maxDate: "" });
$("#startdatepicker")
  .datepicker("option", "dateFormat", "dd.mm.yy");

See
http://api.jqueryui.com/datepicker/#option-dateFormat

Upvotes: 1

Related Questions