PDA

View Full Version : Specifying different date formats for multiple sends to server in ExtJS app



infernoz
9 Feb 2012, 12:13 PM
Hello,

I am specifying the format of my date fields when being sent to my server side with the following code:


Ext.JSON.encodeDate = function(d) {
return Ext.Date.format(d, '"n/j/Y G:i:s"');
};

What if I would want one of my writers to the server to use this format, and I want another one to use something different, and a form to use something different from the first two? This specification gets set at the application level correct? How do I specify it at the component (form, Grid, etc) level?

Cheers!

mitchellsimoens
9 Feb 2012, 1:24 PM
First off I would standardise something like that. Are your fields using the different dateFormats?

infernoz
9 Feb 2012, 5:39 PM
They most likely are not going to be different, however there could be a possibility that one pages dates need to send a different format to the server depending on what pieces of the datetime need to be persisted.

Also, it seems quite odd to just have this call hanging in a global location outside of any component. Wondering what the best practice is for setting how dates/timestamps should be moved to the server.

Cheers