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=-3.4 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, T_SPF_PERMERROR,UNPARSEABLE_RELAY,URIBL_GREY 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 9333B1F54E for ; Fri, 29 Jul 2022 07:04:15 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sendgrid.me header.i=@sendgrid.me header.b="mmAMLCAJ"; dkim-atps=neutral Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 435EF120F63; Fri, 29 Jul 2022 16:03:59 +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 08B37120EA2 for ; Fri, 29 Jul 2022 16:03:55 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendgrid.me; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc; s=smtpapi; bh=de6yfUrPIvgXm8joUbfNkUWB+jRDGTjAiK2Cfj4NYLQ=; b=mmAMLCAJm2Esz7N6KiLkOzyMgfdl8X5zRJjhwoYHhm+ZIbMg13XLdILm0EUjLu+OozHS kFfpZ9JE41YGXs0vcnhyvzeWeilvlNE7qm9Cbpg6ZEpylrPDxPIazpat9lpyvO/ID2wESM Tue8eX0pVmgAd08ZMOv7tsJgsMMrMvxAc= Received: by filterdrecv-68b46c5bd4-hbb97 with SMTP id filterdrecv-68b46c5bd4-hbb97-1-62E38654-1F 2022-07-29 07:03:48.314401358 +0000 UTC m=+644270.415236107 Received: from herokuapp.com (unknown) by geopod-ismtpd-3-0 (SG) with ESMTP id 3pfY-Vt6T76INA1IoHtAoQ for ; Fri, 29 Jul 2022 07:03:48.172 +0000 (UTC) Date: Fri, 29 Jul 2022 07:03:48 +0000 (UTC) From: duerst Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 18946 X-Redmine-Issue-Author: kei-p X-Redmine-Sender: duerst 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-Redmine-MailingListIntegration-Message-Ids: 85763 X-SG-EID: =?us-ascii?Q?sZFLhNnqjcW9Ht8ByfkgOQbWPVETXXFxLuf0UPwpQ=2FbXrx066LnwciY0taRhC1?= =?us-ascii?Q?++A6DTJJ4lt=2FzJkwBQUmmbJXhB+C4nQ033MjSGj?= =?us-ascii?Q?je1hQvhhuI9vO5WHT5cgnZ6fSDozDFfcgxFIc0M?= =?us-ascii?Q?N1rBJj18sCVMr4OMPg5gFK3C6+m+iVO6zFJHwwS?= =?us-ascii?Q?PxABUw67oRSnYRxpiZ0IVo2Cp3BDou0VR6p4HPA?= =?us-ascii?Q?EML8orCu3xxphWDnzL9HRLhBAYV1Jmhx9L3ExLJ?= =?us-ascii?Q?Vzvxli4GDKSCo3Oemw4Tw=3D=3D?= To: ruby-dev@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-dev X-Mail-Count: 51186 Subject: [ruby-dev:51186] [Ruby master Bug#18946] Time#to_date returns incorrect date X-BeenThere: ruby-dev@ruby-lang.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Ruby developers \(Japanese\)" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Reply-To: "Ruby developers \(Japanese\)" Errors-To: ruby-dev-bounces@ruby-lang.org Sender: "ruby-dev" Issue #18946 has been updated by duerst (Martin D=FCrst).=0D =0D =0D This may be due to the Gregorian calendar reform (see https://en.wikipedia.= org/wiki/Gregorian_calendar#Gregorian_reform, which says: "Julian Thursday,= 4 October 1582, being followed by Gregorian Friday, 15 October").=0D =0D Time seems to use a proleptic Gregorian calendar (the Gregorian calendar ex= tended to before the Gregorian reform, see https://en.wikipedia.org/wiki/Pr= oleptic_Gregorian_calendar) while Date seems to be using the Julian calenda= r before the 'official' reform date. Please note that the reform didn't get= applied at that date everywhere; different parts of the globe changed at d= ifferent times, and some churches still use the old calendar.=0D =0D ```=0D Time.local(1582,10,14).to_date=0D =3D> #=0D Time.local(1582,10,15).to_date=0D =3D> #=0D ```=0D =0D Also, please compare:=0D ```=0D Time.local(1500,3,1).to_date=0D =3D> #=0D Time.local(1500,2,29).to_date=0D =3D> #=0D ```=0D (in Time, there's no February 29 in 1500, because it's proleptic)=0D with=0D ```=0D Time.local(1500,3,9).to_date=0D =3D> #=0D Time.local(1500,3,10).to_date=0D =3D> #=0D Time.local(1500,3,11).to_date=0D =3D> #=0D ```=0D In Date, there is a February 29 in 1500, because it's Julian.=0D =0D See also `ri Date`. It may be a good idea to add a note to the documentatio= n for Time, to say that it uses the proleptic Gregorian calendar, and this = is different from Date.=0D =0D Please note that dates are *relatively* easy if the date is close to the pr= esent, but the farther you move out, the more complicated it may get.=20=0D =0D ----------------------------------------=0D Bug #18946: Time#to_date returns incorrect date=0D https://bugs.ruby-lang.org/issues/18946#change-98504=0D =0D * Author: kei-p (Keisuke Ishizawa)=0D * Status: Open=0D * Priority: Normal=0D * ruby -v: 3.1.2=0D * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN=0D ----------------------------------------=0D Time#to_date returns incorrect date.=0D =0D Actual Behavior:=0D ```=0D Time.local(1499, 12, 27).to_date=0D =3D> #=0D ```=0D =0D Expected Behavior:=0D ```=0D Time.local(1499, 12, 27).to_date=0D =3D> #=0D ```=0D =0D =0D =0D --=20=0D https://bugs.ruby-lang.org/=0D