Project

General

Profile

Actions

Misc #19096

closed

[Question] Time with `-00:00` offset is in UTC

Added by andrykonchin (Andrew Konchin) over 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
[ruby-core:110568]

Description

It's a bit unexpected but

Time.new(2022, 1, 1, 0, 0, 0, "-00:00").utc?
# => true

But time with +00:00 or 0 offset is treated as not UTC time:

Time.new(2022, 1, 1, 0, 0, 0, "+00:00").utc? # => false
Time.new(2022, 1, 1, 0, 0, 0, 0).utc? # => false

Is it an intentional behaviour? In this case could you please clarify the reason why it works this way?


ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like1Like0Like0Like0Like0Like0Like0Like0