[ruby-core:121407] [Ruby Bug#21141] `Time#utc?` does not work with a timezone object
From:
"maximecb (Maxime Chevalier-Boisvert) via ruby-core" <ruby-core@...>
Date:
2025-03-19 19:20:19 UTC
List:
ruby-core #121407
Issue #21141 has been updated by maximecb (Maxime Chevalier-Boisvert).
Should we backport this minor doc change?
----------------------------------------
Bug #21141: `Time#utc?` does not work with a timezone object
https://bugs.ruby-lang.org/issues/21141#change-112385
* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Backport: 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
----------------------------------------
```ruby
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")`.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/