Yes, I've taken a brief look

1) agreed
2) I got the impression the 'new Date..' is stored as string in the
JSON object, and thus it would be indistinguishable from a regular
string field with the same content, but if it's just for eval-ing, it
works (although I always get goosebumps when I see code in JSON, the
next iteration of ecma is introducing parsejson() instead of eval()
for exactly this reason). I guess it's about choice.
3) it's ok, as long as you don't use/care about TZ

On Jan 15, 2:57 pm, Timothy Farrell <tfarr...@swgen.com> wrote:
> Did you look at my implementation?
>
> 1) Yes, this is a problem, but we can't get around it when we still need
> a solution.  My solution works for Python 2.5 and 2.6 and the dates are
> supported in all major, modern browsers.
> 2) My implementation doesn't use strings in a JSON object.  It relies on
> the JSON parser parsing the JSON as a Javascript engine would.
> 3) My implementation doesn't parse a timestamp string, rather it builds
> a Javascript date object using the date.  That should be a little more
> cross-locale (is that the right term?)
>
> -tim
>
>
>
> achipa wrote:
> > I believe json doesn't do this by default for at least a couple of
> > reasons
>
> > a) the solution would be programming language/version/application
> > specific
> > b) you can't differentiate strings from dates as json has no metadata
> > on it's fields
> > c) you'd have to stick to a RFC style complicated date parser to avoid
> > regional (=date format) problems
>
> > I actually made a patch for this myself, but it's much more cludgy
> > (that's why I didn't post it here), in my solution made the field look
> > like TIMESTAMP#TZ and added a #DATE to the key name (since I load it,
> > too, a hook removes this and recreates the date object transparently).
>
> > On Jan 14, 7:39 pm, Timothy Farrell <tfarr...@swgen.com> wrote:
>
> >> Yes, it works for date but it does not work for time.  I'm not sure how
> >> this would look implemented into web2py.  (You should read the page more
> >> thoroughly.)
>
> >> -Tim
>
> >> mdipierro wrote:
>
> >>> fantastic. can you email me a patch?
> >>> does it work for date and time too?
>
> >>> On Jan 14, 11:35 am, Timothy Farrell <tfarr...@swgen.com> wrote:
>
> >>>> BAM!
>
> >>>>https://mdp.cti.depaul.edu/web2py_wiki/default/wiki/JSONdatetime
>
> >>>> carlo wrote:
>
> >>>>> Thank you Tim, I am looking forward to it.
>
> >>>>> carlo
>
> >>>>> On 14 Gen, 18:18, Timothy Farrell <tfarr...@swgen.com> wrote:
>
> >>>>>> That's funny, I just dealt with this issue yesterday.  I'll put a tip 
> >>>>>> on
> >>>>>> the wiki and link it.
>
> >>>>>> -tim
>
> >>>>>> carlo wrote:
>
> >>>>>>> I had this problem trying to serialize a (SQLite) date field with
> >>>>>>> simplejson  through "js.dumps(mydata)" :
>
> >>>>>>> File "C:\Python25\web2py\gluon\contrib\simplejson\encoder.py", line
> >>>>>>> 332, in default
> >>>>>>>     raise TypeError("%r is not JSON serializable" % (o,))
> >>>>>>> TypeError: datetime.date(2009, 1, 14) is not JSON serializable
>
> >>>>>>> It seems something similar happened in Django:
>
> >>>>>>>http://code.djangoproject.com/ticket/2460
>
> >>>>>>> Is there any workaround?
>
> >>>>>>> carlo
>
> >>>>>> --
> >>>>>> Timothy Farrell <tfarr...@swgen.com>
> >>>>>> Computer Guy
> >>>>>> Statewide General Insurance Agency (www.swgen.com)
>
> >>>> --
> >>>> Timothy Farrell <tfarr...@swgen.com>
> >>>> Computer Guy
> >>>> Statewide General Insurance Agency (www.swgen.com)
>
> >> --
> >> Timothy Farrell <tfarr...@swgen.com>
> >> Computer Guy
> >> Statewide General Insurance Agency (www.swgen.com)
>
> --
> Timothy Farrell <tfarr...@swgen.com>
> Computer Guy
> Statewide General Insurance Agency (www.swgen.com)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to