Misc #19096
closed[Question] Time with `-00:00` offset is in UTC
Description
Updated by andrykonchin (Andrew Konchin) almost 4 years ago
- Description updated (diff)
Updated by sawa (Tsuyoshi Sawada) almost 4 years ago
Updated by zverok (Victor Shepelev) almost 4 years ago
On my computer (GMT+2, Europe/Kyiv timezone), the same behavior is reproducing since 3.1 (and on the current head).
[Time.new(2022, 1, 1, 0, 0, 0, "+00:00").utc?, Time.new(2022, 1, 1, 0, 0, 0, "-00:00").utc?]
# => [false, true]
Before that (2.7 and 3.0), both are false.
I'll try to debug it later this week if nobody else does.
Updated by zverok (Victor Shepelev) almost 4 years ago
Oh, it is actually deliberate, see #17544:
In RFC 3339, -00:00 is used for the time in UTC is known, but the offset to local time is unknown.
Updated by andrykonchin (Andrew Konchin) almost 4 years ago
Updated by andrykonchin (Andrew Konchin) almost 4 years ago
- Description updated (diff)
Updated by andrykonchin (Andrew Konchin) over 3 years ago
@zverok (Victor Shepelev) Thank you for pointing at the original ticket.
TBH I was waiting so long for some official confirmation because I haven't found any mentioning that https://bugs.ruby-lang.org/issues/17544 affects not only Time#strftime method but also a way how utc offset argument (in Time construction methods) is handled. Even added tests don't check this behaviour.
Updated by nobu (Nobuyoshi Nakada) over 3 years ago
- Status changed from Open to Closed
It is git|296a2cab.
See also the related changesets.
Updated by andrykonchin (Andrew Konchin) over 3 years ago
@nobu (Nobuyoshi Nakada) Thank you!
Updated by duerst (Martin Dürst) over 3 years ago
I'm not sure whether and how much this is relevant, but please note that the Sedate WG in the IETF has a draft (https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-extended-07.html, close to final) that updates RFC 3339 (https://www.rfc-editor.org/rfc/rfc3339). For details, please check https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-extended-07.html#name-updating-rfc-3339.
Updated by nobu (Nobuyoshi Nakada) over 3 years ago
duerst (Martin Dürst) wrote in #note-10:
I'm not sure whether and how much this is relevant, but please note that the Sedate WG in the IETF has a draft (https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-extended-07.html, close to final) that updates RFC 3339 (https://www.rfc-editor.org/rfc/rfc3339). For details, please check https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-extended-07.html#name-updating-rfc-3339.
Thank you for the interesting information.
Although that draft seems not recommending use of -00:00, but it also says
the present specification however does not formally deprecate this syntax.
at https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-extended-07.html#section-2-6