class Optimist::DateOption

Option for dates. Uses Chronic if it exists.

def parse(paramlist, _neg_given)

def parse(paramlist, _neg_given)
  paramlist.map do |pg|
    pg.map do |param|
      next param if param.is_a?(Date)
      begin
        begin
          require 'chronic'
          time = Chronic.parse(param)
        rescue LoadError
          # chronic is not available
        end
        time ? Date.new(time.year, time.month, time.day) : Date.parse(param)
      rescue ArgumentError
        raise CommandlineError, "option '#{self.name}' needs a date"
      end
    end
  end
end

def type_format ; "=<date>" ; end

def type_format ; "=<date>" ; end