-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Rubocop complains about DateTime#to_time
#288
Comments
If this is indeed the case, then the style guide should also be updated: https://github.com/rubocop-hq/rails-style-guide#to-time |
The style guide refers to |
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
May 10, 2021
Fixes rubocop#288. This PR adds `AllowToTime` option (`true` by default) to `Rails/Date`.
9 tasks
koic
added a commit
that referenced
this issue
May 12, 2021
[Fix #288] Add `AllowToTime` option to `Rails/Date`
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
May 17, 2021
Fixes rubocop#288. This PR adds `AllowToTime` option (`true` by default) to `Rails/Date`.
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
May 17, 2021
Fixes rubocop#288. This PR adds `AllowToTime` option (`true` by default) to `Rails/Date`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
Rubocop should not complain about
to_time
on DateTime objects, since they do know about the timezone.Actual behavior
Rubocops raises the error
Do not use 'to_time' on Date objects, because they know nothing about the time zone in use. (convention:Rails/Date)
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: