lib/timeliness/formats.rb in timeliness-0.1.0 vs lib/timeliness/formats.rb in timeliness-0.1.1

- old
+ new

@@ -161,11 +161,11 @@ end end compile_formats end - # Removes US date formats so that ambigious dates are parsed as European format + # Removes US date formats so that ambiguous dates are parsed as European format # def use_euro_formats @date_format_set = FormatSet.compile(date_formats.select { |format| US_FORMAT_REGEXP !~ format }) @datetime_format_set = FormatSet.compile(datetime_formats.select { |format| US_FORMAT_REGEXP !~ format }) end @@ -192,20 +192,20 @@ # and value length. Gives minor speed-up by checking string length. def format_set(type, string) case type when :date [ @date_format_set, @datetime_format_set ] - when :time - if string.length < 11 - [ @time_format_set ] - else - [ @datetime_format_set, @time_format_set ] - end when :datetime if string.length < 11 [ @date_format_set, @datetime_format_set ] else [ @datetime_format_set, @date_format_set ] + end + when :time + if string.length < 11 + [ @time_format_set ] + else + [ @datetime_format_set, @time_format_set ] end else if string.length < 11 [ @date_format_set, @time_format_set, @datetime_format_set ] else