Is it possible to set Messages property for KendoDatePicker?

Viewed 259

I set DateInput property for KendoDatePicker.
Then, is it possible to set Messages property for KendoDatePicker?
I want to change placeholder text, "year","month" and "day", like KendoDateInput compornent(api is here).

3 Answers

No. It's not possible, kendo DatePicker accepts only a Date object. You could overlay the input with your own element and put text on that.

Changing the input will cause your date from the date picker to change as well unfortunately. Therefore overlaying an element on top seems like the best solution at the moment.

You could obtain that behavior by declaring both kendoDatePicker and kendoDateInput within your element.

<input id="datepicker" />

$("#datepicker").kendoDatePicker({

});

$("#datepicker").kendoDateInput({
    messages: {
        "year": "y",
        "month": "m",
        "day": "d",
    }
});

Yes it is. You need to reconfigure the internal kendoDateInput that is embedded inside the kendoDatePicker.

First, declare your datePicker with {dateInput: true} option. Then, apply a setOption on the internal dateInput, as:

var dt1 = $("input1").kendoDatePicker({
        format: "yyyy-MM-dd",
        dateInput: true
    }).data("kendoDatePicker");

dt1._dateInput.setOptions({
  messages:{
    "year": "yyyy",
    "month": "mm",
    "day": "dd"
  }
});
Related