最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Extjs TimeField 显示正常时间格式代码
时间:2026-06-12 09:50:47 编辑:袖梨 来源:一聚教程网

复制代码 代码如下:
Ext.override(Ext.form.TimeField, {
getValue: function () {
return this.value;
},
setValue: function (v) {
this.value = v;
this.setRawValue(this.formatValue(v));
return this;
},
formatValue: function (v) {
if (v.length>8) { //timefield最大不超过8个 大于8个的肯定是json中的
var jsondate = eval("new " + v.substr(1, v.length - 2)).toLocaleTimeString();
jsondate = jsondate.length == 8 ? jsondate.substr(0, 5) : '0' + jsondate.substr(0, 4); //toLocaleTimeString比较弱智,返回的如果小时是小于10 小时位就只有1位
return jsondate;
}
return v;
}
});
相关文章
- CanopyOps:AI Agent 工具实践指南 10-07
- newbie-dev-buddy:实践指南 10-07
- notabene:实践指南 10-07
- cwi-learn:AI Agent 工具实践指南 10-07
- NinFenz:AI Agent 工具实践指南 10-07
- SpaceAssistant:AI Agent 工具实践指南 10-07