Skip to content

Fixed issue with ArgumentError and time formatting#7285

Merged
headius merged 4 commits intojruby:masterfrom
PurityLake:fix-issue-7625
Aug 4, 2022
Merged

Fixed issue with ArgumentError and time formatting#7285
headius merged 4 commits intojruby:masterfrom
PurityLake:fix-issue-7625

Conversation

@PurityLake
Copy link
Contributor

Fixes #7265

RubyTime.atMulti would be passed arg3 as nil if it wasn't given by the user. It complained that the unit couldn't be found.

So I added a check to see if it is nil, if it is then it is set to a symbol :microsecond. This appears to be the default value in CRuby.

Also updated the formatting as it wasn't the same as Ruby 3.

My Ruby Version: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]
Example Code:

Time.at(12345, 500, in: '-04:00')

Ruby:

1969-12-31 23:25:45.0005 -0400

JRuby after PR:

1969-12-31 23:25:45.0005 -0400

@PurityLake
Copy link
Contributor Author

I removed the format specifiers for Time due to failing tests

Copy link
Member

@headius headius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor formatting change but otherwise good.

@headius headius added this to the JRuby 9.4.0.0 milestone Aug 4, 2022
@headius
Copy link
Member

headius commented Aug 4, 2022

Looks good!

@headius headius merged commit f99cba6 into jruby:master Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Time.at argument handling

2 participants