I believe it was a serious oversight in the JavaScript design, carried over to the JSON design, that there is no literal form for a Date object. Every native type in JavaScript other than Date has a literal form.
I was one of the people who worked on that date hack, nearly 10 years ago. It is not JSON-RPC compliant to make any assumptions about the format of a date. As others have said and even though I was a creator of that hack, I no longer endorse that hack, and recommend that dates be passed as strings, in some format that you choose and use consistently, and convert the string to a date at a higher layer of your application. Derrell On Wed, Aug 5, 2015 at 3:50 AM rsantiagopaz <[email protected]> wrote: > fritz wrote > > P.S.: You really shouldn't use rpc.callSync() > > > of course, is only a ad-hoc example. Thanks for your time Fritz. > Finally I get de Date object. > Some like this send, and receive, all Date objects with the proper > convertions: > > > qx.io.remote.Rpc.CONVERT_DATES = true; > qx.io.remote.Rpc.RESPONSE_JSON = true; > var rpc = new qx.io.remote.Rpc("services/", "comp.Prueba"); > try { > var r = rpc.callSync("traerDate"); > } catch (ex) { > alert("Sync exception: " + ex); > } > > > and from PHP: > > return "new Date(Date.UTC(1970,9,3,0,0,0,0))"; > > > I asume this is the "official standard qoxdoo 5.0 hack" for send/receive > Date objects. And works for me. > But if this is not the standard hack or is something wrong or inapropiate > tell me what is the correct procedure, please. > thanks > > > > -- > View this message in context: > http://qooxdoo.678.n2.nabble.com/please-basic-question-about-rpc-date-tp7587409p7587413.html > Sent from the qooxdoo mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >
------------------------------------------------------------------------------
_______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
