Our blazing fast Grid component built with pure JavaScript
My JSON date is coming in as UTC e.g.
,"startdate": "2021-01-09T14:15:00Z","enddate": "2021-01-12T08:00:00Z"
I can put a YYYY-MM-DD format on a column and it formats fine
e.g.
{ field: 'startdate', format : 'YYYY-MM-DD', editor : 'datetimefield' , type: 'startdate' },
But if I try to change it to DD-MMM-YYYY it blows up
{ field: 'enddate', format: 'DD-MM-YYYY', editor : 'datetimefield', type: 'enddate' },
and displays incorrect dates
e.g. see finish column
Last edited by
gregc on Tue Feb 23, 2021 12:33 am, edited 2 times in total.
Spoke too soon, it's since you have not defined your Model field correctly. Add a field which defines it as a date and all should work fine.
new Grid({
appendTo : 'container',
store : {
fields : [
{ name : 'start', type : 'date' }
]
},
columns : [
{ text : 'Date', field : 'start', flex : 1, type : 'date', format : 'DD-MM-YYYY' }
],
data : [
{ start : '2021-01-09T14:15:00Z' }
]
});
This is the Gantt chart, it is the type of 'startdate' and that is predefined right?
Last edited by
gregc on Mon Feb 22, 2021 3:10 pm, edited 1 time in total.
Ah my bad, I should have tested my date formats on a working example, not that old demo, thanks !
Most welcome!
Is there a path of least resistance to get a datetime column added to a regular grid, without importing all the Gantt stuff?
Not sure what you mean, you just
import 'Grid/column/DateColumn.js';
The regular default 'date' column type doesn't have a getTime method and so doesn't work with the datetimefield editor.