PDA

View Full Version : Is there a way to render dates as UTC and edit them inside a grid column?



andreas-spindler
30 Oct 2013, 10:16 AM
Hey,

assuming I have two date objects date1 and date2 and I need to possibility to edit the timespan (date2 - date 1) between them inside a grid, how would I do that????

If you substract two dates from each other, you get the timespan in milliseconds. For readability reasons the customer wants the presentation as 'i:s:u', e.g. 04:56:254 inside the grid. Right now I'm struggling with the task to make them editable. Because, if I create a new date object from the milliseconds the grids date column (format 'H:i:s:u') renders the date in my local timezone (right now +1h).
If I use a standard text column with a renderer that creates my time string out of milliseconds, I cannot use any cell editors for editing this string. Or could I???

My ideal solution would be the possibility to render a date object inside the cell as a UTC string, and not as local time string. Is that possible?

I'm little bit stuck here. Any help would be really wonderful!

Andreas

ettavolt
3 Nov 2013, 9:46 AM
You should better stick to local time at 1st of the January (take a look on how it is done in Ext.form.field.Time).
If you pass it without TZ information to your server, chances are big, that you will have same time in other zones.

andreas-spindler
17 Feb 2014, 3:26 AM
If you pass it without TZ information to your server, chances are big, that you will have same time in other zones.

Well, actually, that's what I want! I'm calculating time spans (date2-date1) which I of course want to present without the timezone offset, but like to have the possibility of Exts format options for presentation.