couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Ogden <...@maxogden.com>
Subject Re: Bug with Date.parse
Date Wed, 06 Jul 2011 21:49:51 GMT
I would recommend using ISO8601/RFC3339 if you want to play nice with
javascript... back in the jchris days couchrest used to use it by default.

require 'time'
Time.now.iso8601

On Wed, Jul 6, 2011 at 2:24 PM, kowsik <kowsik@gmail.com> wrote:

> Tracking down an issue with our production couch's and wanted to run
> this by you guys. We have views that look like this:
>
> emit(Date.parse(doc.updated_at), null);
>
> where the updated_at is generated using CouchRest (Time.now.to_json).
> I was seeing nulls show up as the keys and digging a little deeper
> tracked it down to this:
>
> Date.parse("2011-07-05 14:03:24 -0700") returns NaN with
> Firefox/Spidermonkey and Safari while Chrome/v8 is fine.
>
> [ digging deeper ]
>
> Okay, found out. Turns out we recently upgraded CouchRest to 1.1 which
> no longer monkey patches Time.now resulting in hyphens in the
> yyyy-mm-dd as opposed to slashes in the older version. FF and Safari
> don't likey the hyphens and return Nan which messes up the views.
>
> Just a heads up,
>
> K.
> ---
> http://blitz.io
> http://twitter.com/pcapr
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message