Problem with rendering date in extjs

I am,

I have a problem with the render date for a column. when the browser language is in English, the date is displayed in this format

09/14/2009 09:23 AM

But when I change the browser language to German (displays coreect in English and French), the date is not displayed, it displays NAN/NAN/NAN 12:NAN PM

Here is the code.

var dateRenderer = Ext.util.Format.dateRenderer('m/d/Y h:i A');

var colModel = new Ext.grid.ColumnModel([
{ 
     header: xppo.st('SDE_DATE_OCCURRED'), 
     width: 75, 
     sortable: true, 
     dataIndex: 'DateOccurred', 
     renderer: dateRenderer 
}]);

How can I display the date in other languages. Please help me with this problem.

thank

+3
source share
3 answers

Are you sure that the input date is correctly processed in German? The output of dateRenderer should be the same - if it works at all, the language should not matter. Since you get NaN it is more likely that something in the input for the German language is invalid.

+1

Ext.grid.DateColumn? ...

format: "d.m.Y H:i:s"

, :)

+1

I had a similar problem. But it was fixed only when the correct dateFormat was set . (Of course, the data must be transferred from the server correctly)

reader: new Ext.data.JsonReader({
        root: 'mails',
        totalProperty: 'totalCount',
        idProperty: 'mail_id',
        fields: [
            'mail_id',
            {name: 'mail_date', type: 'date', dateFormat: 'Y-m-d h:i:s'}
        ]
}

...

this.columns = [sm,{
    header: 'Date',
    dataIndex: 'mail_date',
    width: 150,
    renderer: Ext.util.Format.dateRenderer('d.m.Y H:i:s'),
    sortable: true
}];
0
source

Source: https://habr.com/ru/post/1736560/