From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 304901F5AE for ; Sat, 11 Jul 2020 12:40:55 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 73ADF120AAC; Sat, 11 Jul 2020 21:40:20 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 7E19F1209E3 for ; Sat, 11 Jul 2020 21:40:17 +0900 (JST) Received: by filterdrecv-p3mdw1-75c584b9c6-xpzlh with SMTP id filterdrecv-p3mdw1-75c584b9c6-xpzlh-18-5F09B34A-10 2020-07-11 12:40:42.196760301 +0000 UTC m=+1279865.549953028 Received: from herokuapp.com (unknown) by ismtpd0036p1iad2.sendgrid.net (SG) with ESMTP id ZY4OeMpNRLO8hA9IC603DA for ; Sat, 11 Jul 2020 12:40:42.138 +0000 (UTC) Date: Sat, 11 Jul 2020 12:40:42 +0000 (UTC) From: mail@timcraft.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 74918 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17024 X-Redmine-Issue-Author: timcraft X-Redmine-Sender: timcraft X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?uGFz4xhVpY5kA8PiDZy7iXuV7bi0VjjbWcZ9+iPsQfx4LGE8e0H98cA3wtDgcC?= =?us-ascii?Q?4X5OnJTP9D+UC46cUCIGw55DxF8=2F154MW8TsPYf?= =?us-ascii?Q?NB6M2TAfzq4lUyVbtfPG8alJFGPfNv8ysKfguZj?= =?us-ascii?Q?bEdWdruQG2fr7aV1Mt7qlF=2FueWLwzAlJVjlyYRD?= =?us-ascii?Q?7HmXFU2mrxDXbFPB8zHnOf+4GAFm=2FTb8bi76N6G?= =?us-ascii?Q?urMzwCOP4nYGeYWIc=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99128 Subject: [ruby-core:99128] [Ruby master Bug#17024] Times with timezones return incorrect wday and yday X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17024 has been updated by timcraft (Tim Craft). 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.) ---------------------------------------- Bug #17024: Times with timezones return incorrect wday and yday https://bugs.ruby-lang.org/issues/17024#change-86504 * 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/