Welcome! Log In Create A New Profile

Advanced

[njs] "new Date()" incorrectly returned always Jan 1, 1970.

April 15, 2016 10:22AM
details: http://hg.nginx.org/njs/rev/1c50334fbea6
branches:
changeset: 99:1c50334fbea6
user: Igor Sysoev <igor@sysoev.ru>
date: Thu Apr 14 18:23:09 2016 +0300
description:
"new Date()" incorrectly returned always Jan 1, 1970.

diffstat:

njs/njs_date.c | 2 +-
njs/test/njs_unit_test.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 51009da8e3d0 -r 1c50334fbea6 njs/njs_date.c
--- a/njs/njs_date.c Mon Apr 11 14:39:59 2016 +0300
+++ b/njs/njs_date.c Thu Apr 14 18:23:09 2016 +0300
@@ -88,7 +88,7 @@ njs_date_constructor(njs_vm_t *vm, njs_v

if (vm->frame->ctor) {

- if (nargs == 0) {
+ if (nargs == 1) {
time = njs_gettime();

} else if (nargs == 2 && njs_is_string(&args[1])) {
diff -r 51009da8e3d0 -r 1c50334fbea6 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Mon Apr 11 14:39:59 2016 +0300
+++ b/njs/test/njs_unit_test.c Thu Apr 14 18:23:09 2016 +0300
@@ -4025,7 +4025,7 @@ static njs_unit_test_t njs_test[] =
{ nxt_string("Date.parse('-000001-01-01T00:00:00.000Z')"),
nxt_string("-62198755200000") },

- { nxt_string("var d = new Date(); d == Date.parse(d.toString())"),
+ { nxt_string("var d = new Date(); d == Date.parse(d.toISOString())"),
nxt_string("true") },

{ nxt_string("var s = Date(); s === Date(Date.parse(s))"),

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] "new Date()" incorrectly returned always Jan 1, 1970.

Igor Sysoev 787 April 15, 2016 10:22AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 136
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready