[ruby-dev:51187] [Ruby master Bug#18946] Time#to_date returns incorrect date
From:
"kei-p (Keisuke Ishizawa)" <noreply@...>
Date:
2022-07-29 08:26:54 UTC
List:
ruby-dev #51187
Issue #18946 has been updated by kei-p (Keisuke Ishizawa). > Time seems to use a proleptic Gregorian calendar (the Gregorian calendar extended to before the Gregorian reform, see https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar) while Date seems to be using the Julian calendar before the 'official' reform date. Thanks for the detailed explanation. I understand that this is due to the different calendars that Date and Time uses before the 'official' reform date. ---------------------------------------- Bug #18946: Time#to_date returns incorrect date https://bugs.ruby-lang.org/issues/18946#change-98505 * Author: kei-p (Keisuke Ishizawa) * Status: Open * Priority: Normal * ruby -v: 3.1.2 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Time#to_date returns incorrect date. Actual Behavior: ``` Time.local(1499, 12, 27).to_date => #<Date: 1499-12-18 ((2268919j,0s,0n),+0s,2299161j)> ``` Expected Behavior: ``` Time.local(1499, 12, 27).to_date => #<Date: 1499-12-27 ...> ``` -- https://bugs.ruby-lang.org/