You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, RuboCop forbids me from using these, wrongly assuming that time zone information would be lost this way.
This is not the case, the resulting objects are of type ActiveSupport::TimeWithZone with the correct time zone set on them.
Expected behavior
RuboCop shouldn't warn against using constructs with find_zone.
Actual behavior
I am getting RuboCop warnings. As an example:
spec/models/my_model_spec.rb:39:24: C: Do not use Time.local without zone. Use one of Time.zone.local, Time.current, Time.local.in_time_zone, Time.local.utc, Time.local.getlocal, Time.local.iso8601, Time.local.jisx0301, Time.local.rfc3339, Time.local.to_i, Time.local.to_f instead.
travel_to Time.find_zone('EST').local(2017, 2, 17, 8, 0) do
Steps to reproduce the problem
Write a code file containing similar constructs to the ones I've showed and run RuboCop with default settings against the file.
In my codebase, I'm using the following constructs to build times in specified timezones:
However, RuboCop forbids me from using these, wrongly assuming that time zone information would be lost this way.
This is not the case, the resulting objects are of type
ActiveSupport::TimeWithZone
with the correct time zone set on them.Expected behavior
RuboCop shouldn't warn against using constructs with
find_zone
.Actual behavior
I am getting RuboCop warnings. As an example:
Steps to reproduce the problem
Write a code file containing similar constructs to the ones I've showed and run RuboCop with default settings against the file.
RuboCop version
The text was updated successfully, but these errors were encountered: