我觉得应该很简单但仍然不能工作,"toDate.getValue();“没有返回Ext.date对象。我无法格式化日期。
错误:格式未定义。
下面是我的表单字段。
var toDate = new Ext.form.DateField(
{
fieldLabel: "date"
value: new Date(), name: "abs-to-date",
width: 100,
allowBlank: false
}在提交表单时,我想格式化日期。
var toDateTime = toDate.getValue();
console.log(toDate.getValue());
toDateTime.setHours( toHour.getValue(), toMinute.getValue(), 0 );
abs.to = toDateTime.format( Date.patterns.JSONdateTime ); <---------------------发布于 2013-04-11 16:50:45
Extjs 4中有两种不同的日期类型。
1)日期
2) Ext.Date
方法format可用于Ext.date,toDateTime为object of Date。下面是正确的语法。
abs.to = Ext.Date.format(toDateTime, Date.patterns.JSONdateTime );发布于 2013-04-11 01:25:34
'fieldLabel‘后缺少逗号。代码应该是:
var toDate = new Ext.form.DateField({
fieldLabel: "date", //<----------
value: new Date(),
name: "abs-to-date",
width: 100,
allowBlank: false
});https://stackoverflow.com/questions/15931863
复制相似问题