Sencha touch 将日期/时间加载到Sencha Touch模型中

Sencha touch 将日期/时间加载到Sencha Touch模型中,sencha-touch,Sencha Touch,我正在使用Sencha Touch 1.1。我有以下型号和商店: Ext.regModel(TrafficResponse.Models.IncidentReports, { idProperty: 'Id', fields: [ {name: 'Id', type: 'int'}, {name: 'TMCRequestedTime', type: 'date'}, {name: 'TRUDetectedTime', type: '

我正在使用Sencha Touch 1.1。我有以下型号和商店:

Ext.regModel(TrafficResponse.Models.IncidentReports, {
    idProperty: 'Id',
    fields: [
        {name: 'Id', type: 'int'},
        {name: 'TMCRequestedTime', type: 'date'},
        {name: 'TRUDetectedTime', type: 'date'},
        {name: 'SiteArrivalTime', type: 'date'},
        {name: 'SiteDepartedTime', type: 'date'}
    ],
    proxy: {
        type: 'localstorage',
        id: TrafficResponse.Stores.IncidentReports
    },
    writer: {
        type: 'json'
    }
});


truApp.stores.incidentReportStore = new Ext.data.Store({
    model: TrafficResponse.Models.IncidentReports,
    id: TrafficResponse.Stores.IncidentReports,
    autoLoad: true
});
我使用日期/时间选择器(不是标准的Sencha控件)设置日期值,并使用表单的
updateRecord
方法使用表单上的值更新模型

完成
sync()
后,localstorage中的记录具有以下格式的日期值:

2012-02-09T22:15:00.000Z

日期/时间选择器上的值为2012年2月10日星期五08:15,因此看起来好像正在存储GMT值

刷新浏览器并从localstorage加载模型后,localstorage中的值将如上所述保留,但不会加载到模型中。模型中的值为
null

如果我更改模型并将
dateFormat:'c'
添加到字段配置中,则会使用以下值将日期加载到模型中:

2012年2月9日星期四22:15:00 GMT+1000(澳大利亚东部标准时间)

表单上显示的日期也带有该值,该值比最初设置的日期早10小时


如何才能正确加载日期并保留时区?

经过大量的代码处理后,我发现问题是由
datejs
引起的。我删除了
datejs
并使用了Sencha date函数,现在一切都正常了。

经过大量的代码处理后,我发现问题是由
datejs
引起的。我删除了
datejs
并使用了Sencha date函数,现在一切正常