[ruby-dev:51188] [Ruby master Bug#18946] Time#to_date returns incorrect date
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2022-07-29 23:06:58 UTC
List:
ruby-dev #51188
Issue #18946 has been updated by jeremyevans0 (Jeremy Evans). `Time#to_datetime` does not operate the same way, which seems like an undesirable inconsistency: ```ruby Time.local(1499, 12, 27).to_datetime => #<DateTime: 1499-12-27T00:00:00-07:52 ((2268928j,28378s,0n),-28378s,2299161j)> Time.local(1499, 12, 27).to_date => #<Date: 1499-12-18 ((2268919j,0s,0n),+0s,2299161j)> ``` ---------------------------------------- Bug #18946: Time#to_date returns incorrect date https://bugs.ruby-lang.org/issues/18946#change-98527 * 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/