[ruby-dev:51192] [Ruby master Bug#18946] Time#to_date returns incorrect date
From:
"matz (Yukihiro Matsumoto)" <noreply@...>
Date:
2022-08-08 03:02:37 UTC
List:
ruby-dev #51192
Issue #18946 has been updated by matz (Yukihiro Matsumoto). I checked commit history and found out that to_date has been use GREGORIAN calendar since 2011-05-31 and to_datetime preserved the old DEFAULT_SG (ITALY). I assume this is a mistake and both should use GREGORIAN (ext/date/date_core.c:8647). Matz. ---------------------------------------- Bug #18946: Time#to_date returns incorrect date https://bugs.ruby-lang.org/issues/18946#change-98596 * 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/