Question

I am using grid in extjs 3.4 and there is a column with date in the grid. now i want to change the date format before displaying it in the grid. For this i am using following two ways of code

asm_profile_date_format = 'F j, Y'

column = new Ext.grid.Column({
                            header : map['label'],
                            sortable : true,
                            dataIndex : map['name'],
                            renderer :Ext.util.Format.dateRenderer(asm_profile_date_format)
                         });

and

renderer :  function(value)
               {
                     if(value == null)
                          return ' '
                     else
                     {
                            return value.format(asm_profile_date_format);;
                     }
              }

Here the value/input date i am getting is 19/6/2013, but the date after the renderer i am getting is jul 6, 2014.

Was it helpful?

Solution

I tried different combination, but could not make it. The root cause is, it is converting date into month (19 = 12 + 7) which implies as 12 to one more year and 7 to july month. We need to manually convert and show to the user.

One more thing i like to suggest, make the input value in different format from backend. try to return in date format, which will solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top