diff --git a/activemodel/lib/active_model/type/helpers/time_value.rb b/activemodel/lib/active_model/type/helpers/time_value.rb index ad78fd49ec..721f9543ed 100644 --- a/activemodel/lib/active_model/type/helpers/time_value.rb +++ b/activemodel/lib/active_model/type/helpers/time_value.rb @@ -34,7 +34,7 @@ def apply_seconds_precision(value) return value unless precision && value.respond_to?(:usec) number_of_insignificant_digits = 6 - precision round_power = 10**number_of_insignificant_digits - value.change(usec: value.usec / round_power * round_power) + value.change(usec: value.usec - value.usec % round_power) end def type_cast_for_schema(value)