[ZBX-22653] javascript Date.parse dont parse valid ISO_8601 date Created: 2023 Apr 11  Updated: 2024 Oct 24

Status: Confirmed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 6.4.12
Fix Version/s: None

Type: Problem report Priority: Major
Reporter: Andrew Sitnikov Assignee: Zabbix Development Team
Resolution: Unresolved Votes: 1
Labels: javascript, preprocessing
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File date.parse_1.png     PNG File date.parse_2.png    
Issue Links:
Duplicate
duplicates ZBX-24133 JavaScript Date.parser() not working ... Closed

 Description   

In Preprocessing

 

Date.parse('2023-04-06T12:11:59+0300')/1000

Result: 1979703119

 

Valid result: 1680772319 (checked over browser js console)

 

Adding  ":" to TZ part (2023-04-06T12:11:59+03:00) will fix this problem

 

https://en.wikipedia.org/wiki/ISO_8601

Time offsets from UTC[edit

The UTC offset is appended to the time in the same way that 'Z' was above, in the form ±[hh]:[mm], ±[hh][mm], or ±[hh].

Negative UTC offsets describe a time zone west of UTC±00:00, where the civil time is behind (or earlier) than UTC so the zone designator will look like "−03:00","−0300", or "−03"

Positive UTC offsets describe a time zone at or east of UTC±00:00, where the civil time is the same as or ahead (or later) than UTC so the zone designator will look like "+02:00","+0200", or "+02".​

 



 Comments   
Comment by Bartosz Mickiewicz (Inactive) [ 2023 Apr 28 ]

Thanks for reporting that, indeed it looks like your implementation only recognizes timezones with ":" in it. Can you specify Zabbix version used? 

Comment by Andrew Sitnikov [ 2023 Apr 28 ]

Zabbix 6.4.1

Ubuntu 20.04.5 LTS

Comment by Andrew Sitnikov [ 2024 Oct 24 ]

Still exist in v7

 

#>zabbix_js -V
zabbix_js (Zabbix) 7.0.5

 

#>zabbix_js -s a.js -p 1 

1679703119

 

#>cat a.js 
return Date.parse('2023-04-06T12:11:59+0300')/1000

 

P.S. From Tuesday, 11 April 2023 Thursday, 24 October 2024 Result: 562 days ... 

 

Generated at Tue Jun 24 06:44:29 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.