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-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no 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 B69701F463 for ; Fri, 20 Dec 2019 16:23:07 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 006B4120A3E; Sat, 21 Dec 2019 01:22:54 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 1370712095D for ; Sat, 21 Dec 2019 01:22:51 +0900 (JST) Received: by filterdrecv-p3mdw1-56c97568b5-cmx66 with SMTP id filterdrecv-p3mdw1-56c97568b5-cmx66-20-5DFCF55E-6E 2019-12-20 16:22:54.933224585 +0000 UTC m=+315587.993281433 Received: from herokuapp.com (unknown [3.83.106.33]) by ismtpd0046p1iad1.sendgrid.net (SG) with ESMTP id bpBc3SpdSA6IThxR0BviRQ for ; Fri, 20 Dec 2019 16:22:54.859 +0000 (UTC) Date: Fri, 20 Dec 2019 16:22:54 +0000 (UTC) From: stan001212@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72037 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16440 X-Redmine-Issue-Author: st0012 X-Redmine-Sender: st0012 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?cNMZzs5JtKI7CACre8zKf8+TaokBVqw22oA+ftxPRbHCLfMzWU6fZ=2FIEb2RluD?= =?us-ascii?Q?m3za2YeScCG57wajoW=2FR1UvW+BkQW9a1tDi0lXg?= =?us-ascii?Q?SqBhiYQBXvxljtuYDFuc3CysJqZidfx09PA1hRQ?= =?us-ascii?Q?fcqTgXARS++eyUvYpOH5=2Fv0Zk0M21sSzHGohstv?= =?us-ascii?Q?WGR8i5hEKy4rMPov=2F08LGVUe1ln93lVEha271zX?= =?us-ascii?Q?kMU4HV1msjaQl6dvk=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96377 Subject: [ruby-core:96377] [Ruby master Bug#16440] Date range inclusion behaviors are inconsistent 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 #16440 has been reported by st0012 (Stan Lo). ---------------------------------------- Bug #16440: Date range inclusion behaviors are inconsistent https://bugs.ruby-lang.org/issues/16440 * Author: st0012 (Stan Lo) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- It's weird that a Date range can include Time and DateTime objects that were converted from a Date object. But it can't include a newly generated DateTime object. For example: ``` may1 = Date.parse("2019-05-01") may3 = Date.parse("2019-05-03") noon_of_may3 = DateTime.parse("2019-05-03 12:00") may31 = Date.parse("2019-05-31") (may1..may31).include? may3 # => True (may1..may31).include? may3.to_time # => True (may1..may31).include? may3.to_datetime # => True (may1..may31).include? noon_of_may3 # => False ``` Shouldn't the last case return `true` as well? Related Rails issue: https://github.com/rails/rails/issues/36175 -- https://bugs.ruby-lang.org/