From: "andrykonchin (Andrew Konchin)" Date: 2022-11-11T14:50:11+00:00 Subject: [ruby-core:110705] [Ruby master Misc#19121] Time: utc offset argument's formats "+/-HH", "+/-HHMM", "+/-HHMMSS" are supported differently Issue #19121 has been reported by andrykonchin (Andrew Konchin). ---------------------------------------- Misc #19121: Time: utc offset argument's formats "+/-HH", "+/-HHMM", "+/-HHMMSS" are supported differently https://bugs.ruby-lang.org/issues/19121 * Author: andrykonchin (Andrew Konchin) * Status: Open * Priority: Normal ---------------------------------------- I've noticed a strange difference between Ruby versions 2.7, 3.0 and 3.1. The mentioned above formats are supported in Ruby 2.7 and Ruby 3.1 but aren't supported in Ruby 3.0: Ruby 2.7.4 ```ruby Time.new(2000, 1, 1, 0, 0, 0, "+05") # => 2000-01-01 00:00:00 +0500 Time.new(2000, 1, 1, 0, 0, 0, "+0530") # => 2000-01-01 00:00:00 +0530 Time.new(2000, 1, 1, 0, 0, 0, "+053037") # => 2000-01-01 00:00:00 +0530 ``` Ruby 3.0.4 ```ruby Time.new(2000, 1, 1, 0, 0, 0, "+05") #(irb):1:in `initialize': "+HH:MM", "-HH:MM", "UTC" or "A".."I","K".."Z" expected for utc_offset (ArgumentError) Time.new(2000, 1, 1, 0, 0, 0, "+0530") #(irb):2:in `initialize': "+HH:MM", "-HH:MM", "UTC" or "A".."I","K".."Z" expected for utc_offset (ArgumentError) Time.new(2000, 1, 1, 0, 0, 0, "+053037") #(irb):3:in `initialize': "+HH:MM", "-HH:MM", "UTC" or "A".."I","K".."Z" expected for utc_offset (ArgumentError) ``` Ruby 3.1.2 ```ruby Time.new(2000, 1, 1, 0, 0, 0, "+05") # => 2000-01-01 00:00:00 +0500 Time.new(2000, 1, 1, 0, 0, 0, "+0530") # => 2000-01-01 00:00:00 +0530 Time.new(2000, 1, 1, 0, 0, 0, "+053037") # => 2000-01-01 00:00:00 +053037 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: