Bug #17024
closedTimes with timezones return incorrect wday and yday
Description
The timezone support added to Time in Ruby 2.6 does not appear to handle wday and yday.
I don't know what the most appropriate fix is, but looking at time.c and the commit which introduced the timezone feature it looks like vtm->wday
and vtm->yday
are both set by vtm_add_offset
, and that isn't called with the new block of code which handles the timezone.
I've attached a patch to the tests and specs which demonstrates the bug.
Files
Updated by timcraft (Tim Craft) over 4 years ago
For example:
$ irb -r tzinfo
irb(main):001:0> Time.new(2020, 1, 1, 0, 0, 0, TZInfo::Timezone.get('America/New_York')).wday
=> 7
irb(main):002:0> Time.new(2020, 1, 1, 0, 0, 0, TZInfo::Timezone.get('America/New_York')).yday
=> 0
(The wday should be 3, and the yday should be 1.)
Updated by nobu (Nobuyoshi Nakada) over 4 years ago
- Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: DONTNEED, 2.6: REQUIRED, 2.7: REQUIRED
Updated by nobu (Nobuyoshi Nakada) over 4 years ago
- Status changed from Open to Closed
Applied in changeset git|99a9c3fe2eaab8157765d792dc871da6daea0327.
Fixed yday and wday with timezone [Bug #17024]
Updated by nagachika (Tomoyuki Chikanaga) over 4 years ago
- Backport changed from 2.5: DONTNEED, 2.6: REQUIRED, 2.7: REQUIRED to 2.5: DONTNEED, 2.6: REQUIRED, 2.7: DONE
ruby_2_7 4be9bf1f67b997fc519625d56a93b8a68a70d124 merged revision(s) 99a9c3fe2eaab8157765d792dc871da6daea0327.
Updated by usa (Usaku NAKAMURA) almost 4 years ago
- Backport changed from 2.5: DONTNEED, 2.6: REQUIRED, 2.7: DONE to 2.5: DONTNEED, 2.6: DONE, 2.7: DONE
backport into ruby_2_6 at r67911.