lib/rubocop/cop/rails/time_zone.rb in rubocop-rails-2.16.1 vs lib/rubocop/cop/rails/time_zone.rb in rubocop-rails-2.17.0

- old
+ new

@@ -53,11 +53,11 @@ DANGEROUS_METHODS = %i[now local new parse at].freeze ACCEPTED_METHODS = %i[in_time_zone utc getlocal xmlschema iso8601 jisx0301 rfc3339 httpdate to_i to_f].freeze - TIMEZONE_SPECIFIER = /[A-z]/.freeze + TIMEZONE_SPECIFIER = /([A-z]|[+-]\d{2}:?\d{2})\z/.freeze def on_const(node) mod, klass = *node # we should only check core classes # (`Time` or `::Time`) @@ -124,10 +124,10 @@ autocorrect(corrector, node) end end 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 def build_message(klass, method_name, node) if flexible? format(