PDA

View Full Version : NaN-NaN-0NaN NaN:NaN



art.com
4 Apr 2013, 4:42 AM
Hi all,

I've got this bug that is driving me crazy. A datefield in a grid is displaying NaN-NaN-0NaN NaN:NaN as a value in Firefox and IE. But in Chrome is is showing the date and time correctly.

It must be a small option somewhere, but at the moment I can't find it. Is someone here able to track it down?

RETURNED FROM DATABASE:



{"data":[{"id":1,"type":"Day off","startDate":"2013-03-01 08:00:00.0000000","endDate":"2013-03-01 17:00:00.0000000","comment":"Testing","addDate":"2013-03-28 14:53:00.0000000","addUser":"tswinkels","chngDate":null,"chngUser":null}]}

GRID:


...
xtype: 'gridpanel',
margin: 20,
bodyBorder: true,
allowDeselect: true,
columnLines: true,
enableColumnHide: false,
enableColumnMove: false,
forceFit: true,
store: 'employee.absence',
columns: [
{
xtype: 'rownumberer'
},
{
xtype: 'datecolumn',
dataIndex: 'startDate',
menuDisabled: true,
text: 'Start date',
format: 'd-m-Y H:i'
},
{
xtype: 'datecolumn',
dataIndex: 'endDate',
menuDisabled: true,
text: 'End date',
format: 'd-m-Y H:i'
},
{
xtype: 'gridcolumn',
dataIndex: 'type',
menuDisabled: true,
text: 'Type of absence'
},
{
xtype: 'datecolumn',
dataIndex: 'addDate',
menuDisabled: true,
text: 'Add date',
format: 'd-m-Y'
},
{
xtype: 'gridcolumn',
dataIndex: 'comment',
menuDisabled: true,
text: 'Comment'
},
{
xtype: 'gridcolumn',
dataIndex: 'addUser',
menuDisabled: true,
text: 'Added by'
}
],
dockedItems: [
{
xtype: 'pagingtoolbar',
dock: 'bottom',
displayInfo: true,
store: 'employee.absence'
}
]
...


MODEL:


Ext.define('framedash.model.employee.absence', {
extend: 'Ext.data.Model',


fields: [
{
name: 'id'
},
{
name: 'type'
},
{
dateReadFormat: 'Y-m-d H:i:s.u',
dateWriteFormat: 'd-m-Y H:i',
name: 'startDate'
},
{
dateFormat: 'd-m-Y H:i',
dateReadFormat: 'Y-m-d H:i:s.u',
name: 'endDate'
},
{
name: 'comment'
},
{
dateFormat: 'd-m-Y H:i',
dateReadFormat: 'Y-m-d H:i:s.u',
name: 'addDate'
},
{
name: 'addUser'
},
{
name: 'chngDate'
},
{
name: 'chngUser'
}
]
});

slemmon
5 Apr 2013, 10:19 PM
Make sure your date field (http://docs.sencha.com/ext-js/4-2/#!/api/Ext.data.Field) has a type (http://docs.sencha.com/ext-js/4-2/#!/api/Ext.data.Field-cfg-type): 'date' config on it.



type: 'date',
dateReadFormat: 'Y-m-d H:i:s.u',
dateWriteFormat: 'd-m-Y H:i',
name: 'startDate'

art.com
8 Apr 2013, 12:02 AM
Thanks Slemmon! It fixed this issue, completely forgot to check this setting at the model ~o)

luk-3009
24 Aug 2015, 1:19 AM
Hello everybody!

I have a similar problem like art.com had: The grid displays the datetime correctly in Chrome. But in IE and Firefox it only shows: NaN-NaN-0NaN NaN:NaN

From the server I get something like this:

"core_notes": [{
"title": "testtitle",
"description": "testdescription",
"lastedited": {
"date": "2015-08-24 10:20:30.000000",
"timezone_type": 3,
"timezone": "Europe\/Berlin"
},
"creationDate": {
"date": "2015-08-24 10:20:30.000000",
"timezone_type": 3,
"timezone": "Europe\/Berlin"
},
...........

My model looks like this:


..........
fields: [{
name: "id",
type: "integer"
}, {
name: "title",
type: "string"
}, {
name: "description",
type: "text"
}, {
name: "lastedited",
type: "datetime"
}, {
name: "creationDate",
type: "datetime"
}, ],
.........................
So I have declared the type of my fields.

And the gridcolumn looks like this:

'text': 'NOTEPAD::LIST::COLCRDATE',
'xtype': 'datecolumn',
'dataIndex': 'creation_date',
'filterable': true,
'filter': { 'type': 'date' },
'autoWidth': true,
'association': function(column, record, recordIndex, rowIndex, columnIndex) {
return record.get('creationDate').date;
}


I would be very thankful if you could help me with this issue!

Greetings,
luk-3009