lib/qif/reader.rb
def guess_date_format
      begin
        line = @data.gets
        break if line.nil?

        date = line[1..-1]
        guessed_format = Qif::DateFormat::SUPPORTED_DATEFORMAT.find { |format_string, format|
          test_date_with_format?(date, format_string, format)
        }
      end until guessed_format

      @data.rewind

      guessed_format ? guessed_format.first : @fallback_format
    end
def guess_date_format
      begin
        line = @data.gets
        break if line.nil?

        date = line[1..-1]
        guessed_format = Qif::DateFormat::SUPPORTED_DATEFORMAT.find { |format_string, format|
          test_date_with_format?(date, format_string, format)
        }
      end until guessed_format

      @data.rewind

      guessed_format ? guessed_format.first : @fallback_format
    end
Guess the file format of dates, reading the beginning of file, or return nil if no dates are found (?!).