lib/kronic.rb
# Parses day, month and year parts
Parses day, month and year parts
Parses day month and year parts
def parse_exact_date_parts(raw_day, raw_month, raw_year, today)
      day   = raw_day.to_i
      month = month_from_name(raw_month)
      year = if raw_year
        raw_year =~ NUMBER ? raw_year.to_i : nil
      else
        today.year
      end
      return nil unless day && month && year
      begin
        result = Date.new(year, month, day)
        result = result << 12 if result > today && !raw_year
        result
      rescue ArgumentError
        nil
      end
    end
def parse_exact_date_parts ( raw_day , raw_month , raw_year , today ) day = raw_day . to_i month = month_from_name ( raw_month ) year = if raw_year raw_year =~ NUMBER ? raw_year . to_i : nil else today . year end return nil unless day && month && year begin result = Date . new ( year , month , day ) result = result << 12 if result > today && ! raw_year result rescue ArgumentError nil end end
Parses day, month and year parts
Parses day month and year parts
raw_day
<not_specific>
raw_month
<not_specific>
raw_year
<not_specific>
today
<not_specific>