ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: mail@timcraft.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:99127] [Ruby master Bug#17024] Times with timezones return incorrect wday and yday
Date: Sat, 11 Jul 2020 10:22:24 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-17024.20200711102224.7520@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17024.20200711102224.7520@ruby-lang.org

Issue #17024 has been reported by timcraft (Tim Craft).

----------------------------------------
Bug #17024: Times with timezones return incorrect wday and yday
https://bugs.ruby-lang.org/issues/17024

* Author: timcraft (Tim Craft)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.8.0dev
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
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](https://github.com/ruby/ruby/commit/ee58c638b8d10d2ea10faadbc7b34515d2f2e351) 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](https://github.com/ruby/ruby/blob/ee58c638b8d10d2ea10faadbc7b34515d2f2e351/time.c#L2261-L2272).

I've attached a patch to the tests and specs which demonstrates the bug.


---Files--------------------------------
patch.diff (1.03 KB)


-- 
https://bugs.ruby-lang.org/

       reply	other threads:[~2020-07-11 10:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-11 10:22 mail [this message]
2020-07-11 12:40 ` [ruby-core:99128] [Ruby master Bug#17024] Times with timezones return incorrect wday and yday mail
2020-07-12 13:01 ` [ruby-core:99137] " nobu
2020-07-23  2:33 ` [ruby-core:99284] " nagachika00
2021-03-02 11:44 ` [ruby-core:102712] " usa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-17024.20200711102224.7520@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).