PDA

View Full Version : date field in IE8 shows NaN-NaN-0NaN



andrehooijer
29 Oct 2013, 12:11 AM
Hi,

I am displaying a date field in a grid panel and it works in all browsers, except IE8. In IE8 it worked, but since the last update it now shows NaN-NaN-0NaN instead of (for example) 31-12-2012. I use a Dutch formatting of dates (dd-mm-yyyy).
The problem is the use of xtype: 'datecolumn' in the grid panel, but I need that to correctly display the date format. Furthermore I need to be able to do sorting on the date fields.

Code used:


Ext.define('SomeModel', {
extend: 'Ext.data.Model',
fields: ['somedate']
});

var metingModelStore = Ext.create('Ext.data.Store', {
model: "SomeModel",
storeId: "SomeModelStore",
sorters: [
{property: 'somedate', direction: 'ASC'}
],
remoteSort: false,
remoteFilter: true,
pageSize: 50,
proxy: {
type: 'ajax',
url: 'something/selection',
reader: {
type: 'json',
root: 'items'
},
actionMethods: {
create: 'POST', read: 'POST', update: 'POST', destroy: 'POST'
},
simpleSortMode: true
},
updateCounter: function () {
}
});

overview_panel = Ext.create('Ext.grid.Panel', {
store: overviewModelStore,
disableSelection: false,
loadMask: true,
viewConfig: {
id: 'gv1',
trackOver: false,
preserveScrollOnRefresh: true,
stripeRows: true
},
// grid columns
columns: [
{ text: "Some Date",
dataIndex: 'somedate',
xtype: 'datecolumn',
format: 'd-m-Y',
align: 'left',
sortable: true,
menuDisabled: true,
tdCls: 'highlight',
doSort: function(state) {
var field = this.getSortParam();
overviewModelStore.sort({
property: field,
direction: state,
sorterFn: function(v1, v2){
v1 = v1.get(field);
v2 = v2.get(field);
if (v1 > v2 || v1 === null) {return 1}
if (v1 < v2 || v2 === null) {return -1}
return 0;
}
});
}
},
],
});

Gary Schlosberg
31 Oct 2013, 7:53 PM
Looks like it's a bug in IE/Safari:
http://biostall.com/javascript-new-date-returning-nan-in-ie-or-invalid-date-in-safari