Date parsing issues

Declan,

All setting you've set affect only date formatting but not parsing. And unfortunately it seems that there are no clean way to parse DD.MM.YYYY dates in Ruby. But there is a dirty way:

# put it in some initializer class << Date   alias _parse_without_eu_format _parse   def _parse(str, comp = false)     str = str.to_s     str = "#{$3}-#{$2}-#{$1}" if /(\d{2})\.(\d{2})\.(\d{4})/ =~ str     _parse_without_eu_format(str, comp)   end end

class << Date   def try_parse(string, default = nil)     components = ParseDate.parsedate(string)     components.first ? new(*components[0..2]) : default   end end

# then the dates will be parsed correctly p Date.parse("22.04.2009") p Date.parse("04/22/2009")

Dmitry