Actions
Bug #21141
closed`Time#utc?` does not work with a timezone object
Description
require 'timezone'
require 'tzinfo'
t = Time.now(in: "UTC")
t_timezone = Time.now(in: Timezone["UTC"])
t_tzinfo = Time.now(in: TZInfo::Timezone.get("UTC"))
p t.utc? #=> true
p t_timezone.utc? #=> false
p t_tzinfo.utc? #=> false
This also affects strftime("%-z")
.
Updated by nobu (Nobuyoshi Nakada) about 1 month ago
Maybe also this is related:
ENV["TZ"] = "UTC"
p Time.now.utc? #=> false
Is it expected?
In other words, is that Time#utc?
is true a special case, only when the time is created with the methods such as Time.utc
, Time#utc
, etc, that clearly return a UTC time object?
Updated by nobu (Nobuyoshi Nakada) 10 days ago
- Status changed from Open to Closed
Applied in changeset git|06919949a60b42a8f30e8bd0cb075e17b05eebcd.
[Bug #21141] [DOC] Clarify what time is in UTC
Updated by maximecb (Maxime Chevalier-Boisvert) 7 days ago
Should we backport this minor doc change?
Actions
Like0
Like0Like0Like0