Reputation: 28345
By default, the datepicker's format is MM/DD/YYYY, I would like it to be DD/MM/YYYY, is there a way to change it?
Upvotes: 0
Views: 7373
Reputation: 55392
If you can't change your locale settings to DD/MM/YYYY, you could try subclassing the datepicker binding and overriding the _init
method. You need to set the following properties:
this._separatorFirst.value = '/';
this._separatorSecond.value = '/';
this.dayField = document.getAnonymousElementByAttribute(this, "anonid", "input-one");
this.monthField = document.getAnonymousElementByAttribute(this, "anonid", "input-two");
this.yearField = document.getAnonymousElementByAttribute(this, "anonid", "input-three");
this.yearField.parentNode.className = "datetimepicker-input-subbox datetimepicker-year";
this.yearField.size = 4;
this.yearField.maxLength = 4;
this.yearLeadingZero = true;
this.monthLeadingZero = true;
this.dayLeadingZero = true;
this._fieldAMPM.parentNode.collapsed = true;
Also consider filing an enhancement request to override the format with an attribute and/or property.
Upvotes: 1