From 983bbb19cc999266959888a9db691905f2dba43f Mon Sep 17 00:00:00 2001 From: Abdurhman Bin Tayeb Date: Wed, 25 Jan 2023 18:07:34 +0300 Subject: [PATCH] handle when the passed value is a Numeric value --- lib/validates_timeliness/converter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/validates_timeliness/converter.rb b/lib/validates_timeliness/converter.rb index 3b84ec9c..4317ee1b 100644 --- a/lib/validates_timeliness/converter.rb +++ b/lib/validates_timeliness/converter.rb @@ -10,7 +10,7 @@ def initialize(type:, format: nil, ignore_usec: false, time_zone_aware: false) end def type_cast_value(value) - return nil if value.nil? || !value.respond_to?(:to_time) + return nil if value.nil? || !value.respond_to?(:to_time) || value.is_a?(Numeric) value = value.in_time_zone if value.acts_like?(:time) && time_zone_aware? value = case type