[njs] Fixed njs_date_string().
Dmitry Volyntsev
xeioex at nginx.com
Fri Feb 28 15:56:46 UTC 2020
details: https://hg.nginx.org/njs/rev/3f094214cd64
branches:
changeset: 1342:3f094214cd64
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Fri Feb 28 18:56:24 2020 +0300
description:
Fixed njs_date_string().
This closes #292 issue on Github.
diffstat:
src/njs_date.c | 2 +-
src/test/njs_unit_test.c | 3 +++
2 files changed, 4 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r ee5fa0d312df -r 3f094214cd64 src/njs_date.c
--- a/src/njs_date.c Thu Jan 30 21:14:30 2020 +0800
+++ b/src/njs_date.c Fri Feb 28 18:56:24 2020 +0300
@@ -1157,7 +1157,7 @@ njs_date_string(njs_vm_t *vm, njs_value_
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
if (njs_slow_path(isnan(time))) {
- vm->retval = njs_string_invalid_date;
+ *retval = njs_string_invalid_date;
return NJS_OK;
}
diff -r ee5fa0d312df -r 3f094214cd64 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Thu Jan 30 21:14:30 2020 +0800
+++ b/src/test/njs_unit_test.c Fri Feb 28 18:56:24 2020 +0300
@@ -13270,6 +13270,9 @@ static njs_unit_test_t njs_test[] =
{ njs_str("new Date(8.65e15)"),
njs_str("Invalid Date") },
+ { njs_str("njs.dump([new Date(8.65e15)])"),
+ njs_str("[Invalid Date]") },
+
{ njs_str("new Date(0e0.o0)"),
njs_str("Invalid Date") },
More information about the nginx-devel
mailing list