couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Iriele <siriele...@gmail.com>
Subject Re: Strange issue with dates
Date Fri, 06 Feb 2015 00:27:20 GMT
There is probably something off happening when parsing dates between what's
stored on disk in erlang what's sent back. Remember dates are not a thing
in JSON.

My advice would be to NEVER STORE DATES.  "New date().getTime()" and just
get the milliseconds...and when you want to use it use new
date(<milliseconds>). I've personally been bitten by date weirdness So its
best to work with something thats "interpret safe"
On Feb 5, 2015 4:09 PM, "Kiril Stankov" <kiril@open-net.biz> wrote:

> Hi,
>
> I have two update handlers:
>
> ||"|SetCancelled|":|"function(doc,req) {doc['cancelled']=true;
> doc['cancelledDate']=Date.now(); return [doc, 'ok'];}"|,
> "|SetLastVisit|":|"function(doc,req) {doc['lastvisit']=Date.now(); return
> [doc, 'ok'];}"
>
>
> |||
>
> How can it be one is writing the date as Unix date, and the other as Java
> Date??
>
> |    "|cancelled|":|true|,
>    "|cancelledDate|":|"2015-02-03T00:34:19.654Z"|,
>    "|lastvisit|":|1423180381094||
>
>
> I call them one after the other?
>
> Thanks in advance!
> ------------------------------------------------------------------------
> *With best regards,*
> Kiril Stankov
>
>

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