You need !~, not =~. Note that 0 is NOT false, it is true, so
puts "true" if 0
will print "true"
Might I suggest instead using:
Date.parse(date)
instead? This will also make certain the dates are valid, and will
accept things like 07-10-10 as well. You will need to protect that
call inside of a begin ... rescue ... end block though since it will
raise an exception on a format / data error.