[ruby-dev:51194] [Ruby master Bug#18946] Time#to_date returns incorrect date

From: "nobu (Nobuyoshi Nakada)" <noreply@...>
Date: 2022-08-22 03:48:39 UTC
List: ruby-dev #51194
Issue #18946 has been updated by nobu (Nobuyoshi Nakada).


Fixed this issue itself, but turned out Psych had a related issue.
The YAML spec doesn’t considered the calendar systems.
Although I [reported], as it hasn’t been concluded yet, the failing test is excluded now at commit:git|79fdf9712dea4943a15c4ef34348b1a159b62f4a.

[reported]: https://github.com/yaml/yaml/issues/69


----------------------------------------
Bug #18946: Time#to_date returns incorrect date
https://bugs.ruby-lang.org/issues/18946#change-98807

* Author: kei-p (Keisuke Ishizawa)
* Status: Closed
* 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/

In This Thread

Prev Next