Hi Luca,
I have not personally seen this and we certainly use Date parsing in our
views, though it's possible we jumped over 1.5.1 and went straight to
1.6(.1). Perhaps a few things to try to shed some more light here.
What do the couchjs executables look like on each system? That is:
> couchjs -V
> ldd `which couchjs`
And then the output of the program:
> cat test.js
var o = new Date(Date.parse("2014-06-11T04:46:09.011Z"));
print(o);
> couchjs test.js
Probably best to use gist or friendpaste (or similar) when posting the
results back to the list.
Cheers,
Mike
On Wed, Sep 24, 2014 at 7:22 AM, Luca Morandini <[email protected]> wrote:
> Folks,
>
> I have some views that parse timestamps, and they used to work on 1.2.0
> and 1.5.0, but not on 1.5.1
>
> To make my point, I executed this view fragment on both 1.5.0 and 1.5.1:
> log("XXXXXXXXXXXXXXXXXXXXXXXX");
> timestamp= "2014-06-11T04:46:09.011+0000";
> log(" string:" + timestamp + " date:" + (new
> Date(Date.parse(timestamp))));
> timestamp= "2014-06-11T04:46:09.011";
> log(" string:" + timestamp + " date:" + (new
> Date(Date.parse(timestamp))));
> timestamp= "2014-06-11T04:46:09.011Z";
> log(" string:" + timestamp + " date:" + (new
> Date(Date.parse(timestamp))));
> timestamp= "2014-06-11";
> log(" string:" + timestamp + " date:" + (new
> Date(Date.parse(timestamp))));
> log("XXXXXXXXXXXXXXXXXXXXXXXX");
>
> The results are
> On 1.5.0:
> Log :: XXXXXXXXXXXXXXXXXXXXXXXX
> Log :: string:2014-06-11T04:46:09.011+11:00 date:Wed Jun 11 2014
> 03:46:09 GMT+1000 (EST)
> Log :: string:2014-06-11T04:46:09.011 date:Wed Jun 11 2014 04:46:09
> GMT+1000 (EST)
> Log :: string:2014-06-11T04:46:09.011Z date:Wed Jun 11 2014 14:46:09
> GMT+1000 (EST)
> Log :: string:2014-06-11 date:Wed Jun 11 2014 10:00:00 GMT+1000 (EST)
> Log :: string:2014-06-11T04:46:09.011Z date:Wed Jun 11 2014 14:46:09
> GMT+1000 (EST)
> Log :: XXXXXXXXXXXXXXXXXXXXXXXX
> ...everything is fine.
>
> On 1.5.1:
> Log :: XXXXXXXXXXXXXXXXXXXXXXXX
> Log :: string:2014-06-11T04:46:09.011+11:00 date:Invalid Date
> Log :: string:2014-06-11T04:46:09.011 date:Invalid Date
> Log :: string:2014-06-11T04:46:09.011Z date:Invalid Date
> Log :: string:2014-06-11 date:Invalid Date
> Log :: string:2014-06-11T04:46:09.011Z date:Invalid Date
> Log :: XXXXXXXXXXXXXXXXXXXXXXXX
>
> Therefore, it looks like I am getting invalid dates no matter what on
> 1.5.1... can someone shed some light ?
>
> 1.5.1 runs on: CentOS 2.6.32-431.17.1.el6.x86_64, Erlang R14B04
> (erts-5.8.5) and it was compiled from source, since no binary is available
> for said environment.
>
> Regards,
>
> Luca Morandini
> Data Architect - AURIN project
> Melbourne eResearch Group
> Department of Computing and Information Systems
> University of Melbourne
> Tel. +61 03 903 58 380
> Skype: lmorandini
>
>