Actions
Bug #19292
closedTime object's wday, yday, and isdst returns broken value (and so does to_a) when kwarg in: 'UTC' was given
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2022-12-30T15:31:50Z master 0bb07e5ba4) +YJIT [arm64-darwin21]
Description
$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').wday"
7
$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').yday"
0
$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').isdst"
-e:1:in isdst': isdst is not set yet (RuntimeError) from -e:1:in
'
$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').to_a"
[0, 0, 0, 1, 1, 2023, 7, 0, true, "UTC"]
where the expected to_a
value should be:
[0, 0, 0, 1, 1, 2023, 0, 1, false, "UTC"]
This bug seems to be happening on the following conditions:
- On any given date and time, regardless of past or future
- Either on
Time.new(Integer, Integer, ...)
style orTime.new(String)
style - Only when
in: 'UTC'
kwarg was given. Other formats likein: '+0000'
orin: 0
seems to be OK - On all Ruby versions that accept kwarg
in:
(3.1, 3.2, and 3.3)
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0