Validating dates in rails using chronic quality internet dating

I'm from Russia and started learingn Ro R with book "Agile Web Development with Rails".Right now I'm trying to practice in building web applications using Ruby on Rails. 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?

computed_options[:before]) result = ['must be a date'] result.push('on or after', computed_options[:on_or_after]) if computed_options[:on_or_after] result.push('after', computed_options[:after]) if computed_options[:after] result.push('and') if needs_and result.push('on or before', computed_options[:on_or_before]) if computed_options[:on_or_before] result.push('before', computed_options[:before]) if computed_options[:before] result.join(' ') end def compute_options(record) result = do |key, val| next unless checks.include? From all the documentation i have been reading, chronic should parse '10/20/1985' as mm/dd/yyyy, but it seems that it's parsing it as dd/mm/yyyy.

627

Leave a Reply