-
Problem report
-
Resolution: Duplicate
-
Major
-
None
-
None
-
None
Steps to reproduce:
- Create an item with the JavaScript preprocessing step with the following parameter:
var timestampWithTimezone = "2024-02-20T13:16:00+0100"; //var timestampWithTimezone = "2024-02-20T13:16:00+01:00"; var date = new Date(timestampWithTimezone); var unixTime = date.getTime() / 1000; return unixTime;
- Test it.
Result:
Wrong unixtime is returned:
Returned 1708074960 which converts to 2024-02-16T09:16:00
Different inputs have different results:
- 2024-02-20T13:16:00+0100 - doesn't work
- 2024-02-20T13:16:00+01:00 - works as expected
Expected:
Correct conversion to 2024-02-20T13:16:00+0100
According to the:
https://github.com/svaarala/duktape/blob/master/doc/datetime.rst
and
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format
We should support both cases.
- is duplicated by
-
ZBX-22653 javascript Date.parse dont parse valid ISO_8601 date
- Confirmed