CARVIEW |
Select Language
HTTP/2 200
x-amz-id-2: SGu+aDawRIoJzYD9FJXN9HnRevmzokzKHoyqoemb8p7E+MtW9emfdkTlUq3JdXzLpMbBf6vZwOw=
x-amz-request-id: 8Q7WDHEKGYJGJ7RC
last-modified: Fri, 02 May 2025 21:41:33 GMT
etag: "e549748deaf1ffaa8dc30c5985b01b9d"
x-amz-server-side-encryption: AES256
server: AmazonS3
content-encoding: gzip
via: 1.1 varnish, 1.1 varnish
content-type: text/plain; charset=utf-8
accept-ranges: bytes
age: 0
date: Mon, 28 Jul 2025 01:42:20 GMT
x-served-by: cache-tyo11924-TYO, cache-bom-vanm7210030-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753666940.861444,VS0,VE341
vary: Accept-Encoding
content-length: 647
From: "mame (Yusuke Endoh) via ruby-core"
Date: 2025-05-02T21:32:48+00:00
Subject: [ruby-core:121801] [Ruby Bug#21301] Invalid Dates Accepted When Using "UTC" in Time.new
Issue #21301 has been reported by mame (Yusuke Endoh).
----------------------------------------
Bug #21301: Invalid Dates Accepted When Using "UTC" in Time.new
https://bugs.ruby-lang.org/issues/21301
* Author: mame (Yusuke Endoh)
* Status: Open
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
2025-04-31 does not exist, but, when creating a time object with the "UTC" zone, the value is accepted without error:
```ruby
Time.new(2025, 4, 31, 0, 0, 0, "UTC") #=> expected: 2025-05-01 00:00:00 UTC
#=> actual: 2025-04-31 00:00:00 UTC
```
In contrast, using the "+00:00" time zone works as expected and rolls the date over to 2025-05-01:
```ruby
Time.new(2025, 4, 31, 0, 0, 0, "+00:00") # => 2025-05-01 00:00:00 +0000
```
Note that 2025-04-30T24:00:00Z is correctly rolled over to 2025-05-01T00:00:00Z.
And 2025-04-31T24:00:00Z is rolled over to 2025-04-01!
```ruby
Time.new(2025, 4, 30, 24, 0, 0, "UTC") #=> 2025-05-01 00:00:00 UTC # OK
Time.new(2025, 4, 31, 24, 0, 0, "UTC") #=> 2025-04-01 00:00:00 UTC # What?
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/