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

Rails/TimeZone: Allow usage of Time.at with the in: keyword arg #821

Closed
pbstriker38 opened this issue Oct 20, 2022 · 0 comments · Fixed by #879
Closed

Rails/TimeZone: Allow usage of Time.at with the in: keyword arg #821

pbstriker38 opened this issue Oct 20, 2022 · 0 comments · Fixed by #879

Comments

@pbstriker38
Copy link

Is your feature request related to a problem? Please describe.

Do not report errors with Time.at usage when using the optional in keyword argument.

C: [Correctable] Rails/TimeZone: Do not use Time.at without zone. Use one of Time.zone.at, Time.current, Time.at.in_time_zone, Time.at.utc, Time.at.getlocal, Time.at.xmlschema, Time.at.iso8601, Time.at.jisx0301, Time.at.rfc3339, Time.at.httpdate, Time.at.to_i, Time.at.to_f instead. (https://rails.rubystyle.guide#time, http://danilenko.org/2012/7/6/rails_timezones)
    Time.at(1_666_293_663, in: 'UTC')
         ^^

Describe the solution you'd like

Consider Time.at with in: to be valid

Time.at(1_666_293_663, in: 'UTC')

Describe alternatives you've considered

Using .utc also works but I feel is less clear on its intent.

irb(main):160:0> Time.at(1_666_293_663)
=> 2022-10-20 12:21:03 -0700
irb(main):161:0> Time.at(1_666_293_663).utc
=> 2022-10-20 19:21:03 UTC
irb(main):162:0> Time.at(1_666_293_663, in: 'UTC')
=> 2022-10-20 19:21:03 UTC
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 a pull request may close this issue.

1 participant