My Ext.grid has a datecolumn, but I'm experiencing an issue where the dates displayed are off by one day. The problem seems to be related to timezones, as when data is added to the store it shows up differently later on.
For example, 2013-03-31
becomes
Sat Mar 30 2013 17:00:00 GMT-0700 (US Mountain Standard Time)
.
I'm unsure how to resolve this timezone discrepancy in my code. When adding data to the grid's store using the following snippet:
for (var i = 0; i < dateboxes.length; i++)
{
dateboxGrid.store.add(dateboxes[i]);
}
console.log(dateboxGrid.getStore()) // logs "Sat Mar 30 2013 17:00:00 GMT-0700 (US Mountain Standard Time)"
Is there a way to properly format dateboxes[i].Value
before inserting it into the store to ensure the correct date appears in the column?
Update:
After some modifications, I now call .toISOString()
on the date before saving it to the database. This adjustment results in the date being stored correctly with GMT +0700
, displaying accurately when loaded from the database.
However, I'm concerned that this method may cause issues for users in different timezones.
In essence, all I need is a straightforward Date value without any time components, as they hold no relevance in my application.