mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-25 15:22:58 +00:00
ignore time part for dates in validation
This commit is contained in:
@@ -34,6 +34,10 @@ module ValidatesTimeliness
|
||||
if type == :time
|
||||
# Rails dummy time date part is defined as 2000-01-01
|
||||
time_array[0..2] = 2000, 1, 1
|
||||
elsif type == :date
|
||||
# throw away time part and check date
|
||||
time_array[3..5] = 0, 0, 0
|
||||
Date.new(*time_array[0..2])
|
||||
else
|
||||
# Date.new enforces days per month, unlike Time
|
||||
Date.new(*time_array[0..2])
|
||||
|
||||
Reference in New Issue
Block a user