Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime._strptime("...", "%z") behaves differently from Ruby 3.2 #94

Closed
dmikurube opened this issue Mar 28, 2023 · 1 comment
Closed

Comments

@dmikurube
Copy link

They may be ultimate cases, so may not be to fix. But reporting just in case.

require 'date'
puts DateTime._strptime("UTC+99:13", "%z")
puts DateTime._strptime("UTC+99:13:14", "%z")
puts DateTime._strptime("UTC+912:42", "%z")
puts DateTime._strptime("UTC+912:42:49", "%z")
puts DateTime._strptime("UTC-99:13", "%z")
puts DateTime._strptime("UTC-99:13:14", "%z")
puts DateTime._strptime("UTC-912:42", "%z")
puts DateTime._strptime("UTC-912:42:49", "%z")

Until Ruby 3.1 (tested with 2.7.7, 3.0.5, 3.1.3)

{:zone=>"UTC+99:13", :offset=>357180}
{:zone=>"UTC+99:13:14", :offset=>357194}
{:zone=>"UTC+912:42", :offset=>3285720}
{:zone=>"UTC+912:42:49", :offset=>3285769}
{:zone=>"UTC-99:13", :offset=>-357180}
{:zone=>"UTC-99:13:14", :offset=>-357194}
{:zone=>"UTC-912:42", :offset=>-3285720}
{:zone=>"UTC-912:42:49", :offset=>-3285769}

From Ruby 3.2 (tested with Ruby 3.2.1)

{:zone=>"UTC+99:13", :offset=>nil}
{:zone=>"UTC+99:13:14", :offset=>nil}
{:zone=>"UTC+912:42", :offset=>nil}
{:zone=>"UTC+912:42:49", :offset=>nil}
{:zone=>"UTC-99:13", :offset=>nil}
{:zone=>"UTC-99:13:14", :offset=>nil}
{:zone=>"UTC-912:42", :offset=>nil}
{:zone=>"UTC-912:42:49", :offset=>nil}
dmikurube added a commit to embulk/embulk-util-rubytime that referenced this issue Mar 28, 2023
This case started to be incompatible from Ruby 3.2.

* #66
* ruby/date#94
@nobu
Copy link
Member

nobu commented Jan 29, 2024

+99 is out of range of hour.

@nobu nobu closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants