Project

General

Profile

Actions

Bug #18922

closed

Time at 24:00:00 UTC is not normalized

Added by nobu (Nobuyoshi Nakada) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:109233]

Description

Reported by @mame (Yusuke Endoh).

$ ruby3.0 -e 'p Time.new(2000, 1, 1, 24, 0, 0, "-00:00").to_a[0, 6]'
[0, 0, 0, 2, 1, 2000]
$ ruby3.1 -e 'p Time.new(2000, 1, 1, 24, 0, 0, "-00:00").to_a[0, 6]'
[0, 0, 24, 1, 1, 2000]
$ ruby3.2 -e 'p Time.new(2000, 1, 1, 24, 0, 0, "-00:00").to_a[0, 6]'
[0, 0, 24, 1, 1, 2000]

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #19106: Time - Hour 24 with tzinfo to_s bugClosedActions

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Subject changed from Time at 24:00:00 UTC is not normalized since 3.1 to Time at 24:00:00 UTC is not normalized
  • Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED to 2.7: REQUIRED, 3.0: DONTNEED, 3.1: REQUIRED

Time.new(2000, 1, 1, 24, 0, 0, "Z").to_a[0, 6] returns [0, 0, 24, 1, 1, 2000] since 2.7.
It seems to be a much older bug, just that "Z" was not supported 2.6 and earlier and didn’t appear.

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Backport changed from 2.7: REQUIRED, 3.0: DONTNEED, 3.1: REQUIRED to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED
Actions #3

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset git|68903df6f6fc548f3bf68fb09ee8b2495dcd28f0.


[Bug #18922] Normalize time at 24:00:00 UTC

Updated by mame (Yusuke Endoh) over 2 years ago

As a record: the behavior I found was about Time#inspect, which was clearly wrong.

$ ruby -ve 'p Time.new(2000, 1, 1, 24, 0, 0, "Z")'
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
2000-01-01 23:00:00 UTC

After nobu's patch, it works correctly.

$ ./miniruby -ve 'p Time.new(2000, 1, 1, 24, 0, 0, "Z")'
ruby 3.2.0dev (2022-07-18T10:07:55Z master a74634de10) [x86_64-linux]
2000-01-02 00:00:00 UTC

Updated by nagachika (Tomoyuki Chikanaga) over 2 years ago

  • Backport changed from 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE

ruby_3_1 13ee4b2c35bad0f893d5ed5a6fdca62da406f958 merged revision(s) 68903df6f6fc548f3bf68fb09ee8b2495dcd28f0.

Actions #6

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Related to Bug #19106: Time - Hour 24 with tzinfo to_s bug added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0