Module: IndeedUtilities

Instance Method Summary collapse

Instance Method Details

#date_normalize(date) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/indeed_utilities.rb', line 16

def date_normalize(date)
  begin
    date = date+"-01-01" if date =~ /^(19|20)\d{2}$/
    return Date.parse(date)
  rescue
    return date
  end
end

#parse_dates(dates) ⇒ Object

Parse dates



5
6
7
8
9
10
11
12
13
14
# File 'lib/indeed_utilities.rb', line 5

def parse_dates(dates)
  start_date = dates
  end_date = dates
  
  if dates.include?(" to ")
    start_date, end_date = dates.split(" to ")
  end

  return date_normalize(start_date), date_normalize(end_date)
end