I found many forum posts about the problem I want to ask, but I still can't figure out, so I hope that you will help me.
private Date ikeitimoData;
I have date object ikeitimoData and I save it to database as date object. In spring this variable looks:
System.out.println(ikeitimoData);
// (answer) Fri Jun 13 2014 03:00:00 GMT+0300 (FLE Daylight Time)
However, when I send request to get this value with ExtJs it looks:
1310428800000
it means it is converted to milliseconds, but it is still not a problem.
Ext.define('Turtas.model.Orlaiviai', {
extend: 'Turtas.model.BaseModel',
fields: [
{
name: 'ikeitimoData', type: 'date',
convert: function (newValue, model) {
console.log(new Date(newValue));
return new Date(newValue);
}
},
]
});
I use this model to store data in grid. This is my grid column where i want to represent date.
columns:[
{
text: 'Įkeitimo data',
dataIndex: 'ikeitimoData',
xtype: 'datecolumn',
format:'Y-m-d'
editor: {
xtype: 'datefield',
format: 'd-m-Y'
}]
My displayed date looks like this:
Fri Jun 13 2014 03:00:00 GMT+0300 (FLE Daylight Time)
Exact as it was in spring. I specified column xtype: 'datecolumn', I specified it's format: 'Y-m-d'(so I want i to look like: 2014-06-13). But it doesn't change anything. If I don't specify these properties everything looks the same. I tried many things, and have no idea how to solve this problem by myself, so I'm looking forward for your answers, thanks!
UPDATE
The problem was in my model. I switched field type to 'time' and everything works fine, because my answer from back-end was in milliseconds. Now everything works fine. I hope this problem solution will help someone too!
Ext.define('Turtas.model.Orlaiviai', {
extend: 'Turtas.model.BaseModel',
fields: [
{
name: 'ikeitimoData', type: 'time',
},
]
});