-
22 Nov 2011 7:19 PM #1
Microsoft Date in from REST, but no Microsoft Date out to REST
Microsoft Date in from REST, but no Microsoft Date out to REST
This is causing major heartache for me.
So I use the
But this only reads the date in from ASP.NET WCF, but it kills my service and sends a bad request 400. We had tested this with jQuery and this is the same. I need to send the date back in the M$ Date Format.Code:dateFormat: 'MS'
How does the proxy or form or store or model get overridden so that the date format is in the M$ format?
The format that gets sent to the server is:
HTML Code:2011-05-24T00:00:00
-
22 Nov 2011 10:48 PM #2Sencha - Community Support Team
- Join Date
- Nov 2007
- Location
- Helsingborg, Sweden
- Posts
- 2,455
- Vote Rating
- 52
That's the default JSON format of an encoded date. You'll have to override some internal methods of Ext to have it another way.
Look for "Ext.JSON = new(function() {"
You'll need to patch these I think:
Code:this.encodeDate = function(o) { return '"' + o.getFullYear() + "-" + pad(o.getMonth() + 1) + "-" + pad(o.getDate()) + "T" + pad(o.getHours()) + ":" + pad(o.getMinutes()) + ":" + pad(o.getSeconds()) + '"'; }; isNative = function() { var useNative = null; return function() { if (useNative === null) { useNative = Ext.USE_NATIVE_JSON && window.JSON && JSON.toString() == '[object JSON]'; } return useNative; }; }(),
-
23 Nov 2011 7:05 AM #3
Thanks mankz. That helped a lot. You pointed me in the right direction to just override the function as you stated.
Code:Ext.JSON.encodeDate = function (d) {return '"' + Ext.Date.format(d, 'MS') + '"';};Last edited by CrazyEnigma; 23 Nov 2011 at 9:53 AM. Reason: Proper Syntax
-
5 Feb 2013 6:04 AM #4


Reply With Quote

