Closed
Description
Is your feature request related to a problem? Please describe.
Similar to #440, we are often use this construct in tests :
Time.parse("2022-10-30 00:00:00 CEST +02:00")
It's especially usefull for explicit summer/winter time :
Time.parse("2022-10-30 00:00:00 CEST +02:00")
=> 2022-10-30 00:00:00 +0200
Time.parse("2022-10-31 00:00:00 CET +01:00")
=> 2022-10-31 00:00:00 +0100
Describe the solution you'd like
If detecting zones abbreviations might be too overwhelming, the cop should be able to detect and allow time offsets from UTC.
Similar to #441 :
- TIMEZONE_SPECIFIER = /[A-z]/.freeze
+ TIMEZONE_SPECIFIER = /([A-z]|[+-]\d{2}:\d{2})\Z/.freeze
def attach_timezone_specifier?(date)
- date.respond_to?(:value) && TIMEZONE_SPECIFIER.match?(date.value.to_s[-1])
+ date.respond_to?(:value) && TIMEZONE_SPECIFIER.match?(date.value.to_s)
end
Activity