[英]How to change datepicker date format?
If you can't change your locale settings to DD/MM/YYYY, you could try subclassing the datepicker binding and overriding the _init
method. 如果您无法将区域设置更改为DD / MM / YYYY,则可以尝试对datepicker绑定进行子类化并覆盖
_init
方法。 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. 还要考虑提交增强请求以使用属性和/或属性覆盖格式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.