Reputation: 103
Why node is showing the wrong UTC? It should show UTC -3 not UTC -2.
I'm in Brazil so my official UTC now is -3. If I try to do new Date().toString()
on Chrome Console, its show UTC -3. When I run the same code on Node, its show UTC -2 even if I start the Node with TZ=America/Sao_Paulo doing env TZ='America/Sao_Paulo' node
.
Where the UTC value came from?
Upvotes: 0
Views: 69
Reputation: 241959
This was addressed in IANA TZDB 2019b. Node missed the 2019b update, but recently updated to the subsequent 2019c release. This is in Node.js LTS 12.13.1 (see release notes), and also in the current 13.2.0 (see release notes).
Update your Node.js version to resolve the issue.
Aside: The terminology in your question is slightly incorrect. UTC is the reference (+00:00
). When you refer to UTC-3 or UTC-2, those are referred to as offsets. More specifically, "time zone offsets" or "UTC offsets" or "offsets from UTC".
Upvotes: 2