I suspect you've hit the nail on the head, Derrell, the call_date
value is quoted in the return data.  Had it shown up as a literal "new
Date(...)" after being evaled on the client side, I probably would
have figured this out.  It was quite late both nights I looked at
this, and it took me a while just to figure out what I should be
passing back for a date.

Also, I'm using an OLD, slightly hacked version of RpcPerl (before
Tobi was involved), and it does not have the ugly hack.  Looks like
that ugly hack would do the trick.  I will look at upgrading or adding
the hack to my version.

Thank you both for your help,
Pat

On Tue, Mar 23, 2010 at 8:34 AM, Derrell Lipman
<[email protected]> wrote:
> On Mon, Mar 22, 2010 at 23:35, Patrick Paskvan <[email protected]>
> wrote:
>>
>> Hello List,
>>
>> >From what I can tell from the documentation and qooxdoo code, qooxdoo
>> is simply evaling the json return value of an RPC call.  In order to
>> pass a date from the server to client and have the client
>> automagically turn it into a javascript date object, we should simply
>> use "new Date(<date values>)" as the return value.
>>
>> I'm using the Perl RPC backend and tried doing this by hand, but end
>> up with 'null' on the client side.  Same result when using the date
>> class provided by the Perl backend.  Here is a sample of the return
>> data when using the date class provided by the Perl backend (calling
>> $call_date->toJson() when adding it to the return data):
>>
>> {"id":2,"result":[{"urgency":"2 days","customer_id":"24","notes":"no
>> comment","load_id":"1","call_date":"new
>> Date(Date.UTC(2010,2,20,0,0,0,0))","miles":"20","call_time":"14:45"}]}
>>
>> That "call_date" value ends up as null.
>>
>> I saw the recent thread about using ISO date formats.  I attempted
>> that, as well, in case I missed something when reviewing the framework
>> code.
>>
>> I think I'm just missing something simple.  Any help would be appreciated.
>
> Are you hand-formatting the JSON, or using RpcPerl's implementation of the
> JSON formatter? RpcPerl's test of dates does this:
>
> sub method_getCurrentTimestamp
> {
>     my $now = time;
>
>     return {now  => $now,
>             json => new Qooxdoo::JSONRPC::Date ($now)};
> }
>
> Looking at the JSONRPC.pm (and attempting to grok perl at the same time), I
> see that there's a package for dealing with qooxdoo dates. Its constructor
> (or rather, its "new" method) expects a time in epoch format. It does,
> however, provide a "set" method that accepts the year, month, ... fields. I
> also notice that it needs to do some post-processing (which you have not
> done in your example) to remove the surrounding quotes. There should be no
> quotes around new Date(...) so when it gets evaluated at the frontend, it
> becomes a Date object, not a String.
>
> Since you obviously have a far better grasp of perl than I, I'd suggest that
> you take a look at the qooxdoo test methods in
> qooxdoo-contrib/RpcPerl/trunk/Qooxdoo/Services/qooxdoo/test.pm and at the
> implementation of date handling in
> qooxdoo-contrib/RpcPerl/trunk/Qooxdoo/JSONRPC.pm (which begins at line 697).
> Also, look at the "really ugly hack" comment near line 509.
>
> Hope that helps.
>
> Derrell
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to