ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "jeremyevans0 (Jeremy Evans)" <noreply@ruby-lang.org>
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:51188] [Ruby master Bug#18946] Time#to_date returns incorrect date
Date: Fri, 29 Jul 2022 23:06:58 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-98527.20220729230658.52442@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-18946.20220729062905.52442@ruby-lang.org>

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/

  parent reply	other threads:[~2022-07-29 23:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29  6:29 [ruby-dev:51185] " kei-p (Keisuke Ishizawa)
2022-07-29  7:03 ` [ruby-dev:51186] " duerst
2022-07-29  8:26 ` [ruby-dev:51187] " kei-p (Keisuke Ishizawa)
2022-07-29 23:06 ` jeremyevans0 (Jeremy Evans) [this message]
2022-08-08  3:02 ` [ruby-dev:51192] " matz (Yukihiro Matsumoto)
2022-08-22  3:48 ` [ruby-dev:51194] " nobu (Nobuyoshi Nakada)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-98527.20220729230658.52442@ruby-lang.org \
    --to=noreply@ruby-lang.org \
    --cc=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).