lib/trailblazer/finder/utils/string.rb in trailblazer-finder-0.2.6 vs lib/trailblazer/finder/utils/string.rb in trailblazer-finder-0.2.7

- old
+ new

@@ -34,10 +34,15 @@ def self.to_date(value) Date.parse(value).strftime("%Y-%m-%d") if date?(value) end def self.date?(date) - date_hash = Date._parse(date.to_s) + return false unless + date.kind_of?(::DateTime) || + date.kind_of?(::Date) || + date.kind_of?(::String) + return false if date.kind_of?(::String) && date.size == 36 # Ignore uuids that could get casted to dates + date_hash = ::Date._parse(date.to_s) Date.valid_date?(date_hash[:year].to_i, date_hash[:mon].to_i, date_hash[:mday].to_i) end end end end