def set_date(year, month, day)
      raise invalid_date if (year.nil? || year == 0 || !((1..12).include? month))
      begin
        ::Date.new(year, month, day)
      rescue ArgumentError
        raise invalid_date
      end
      @year = year.to_i
      @month = month
      @day = day
    end
def set_date(year, month, day)
      raise invalid_date if (year.nil? || year == 0 || !((1..12).include? month))
      begin
        ::Date.new(year, month, day)
      rescue ArgumentError
        raise invalid_date
      end
      @year = year.to_i
      @month = month
      @day = day
    end
An atomic function to set the date component (year, month and day)
 Raises +ArgumentError+ if invalid date