ignore time part for dates in validation

This commit is contained in:
Adam Meehan
2008-07-11 17:23:37 +10:00
parent eafce02a73
commit 20ed2b1633
2 changed files with 16 additions and 0 deletions

View File

@@ -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])