Project

General

Profile

ActionsLike0

Misc #19096

closed

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

Added by andrykonchin (Andrew Konchin) over 2 years ago. Updated about 2 years 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)
#1

Updated by andrykonchin (Andrew Konchin) over 2 years ago

  • Description updated (diff)
#6

Updated by andrykonchin (Andrew Konchin) over 2 years ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Status changed from Open to Closed
ActionsLike0

Also available in: Atom PDF