2015-12-16 08:07:31 +03:00
|
|
|
# frozen_string_literal: false
|
2022-01-04 10:32:45 +03:00
|
|
|
require_relative '../optparse'
|
2003-05-21 08:27:06 +04:00
|
|
|
require 'date'
|
|
|
|
|
|
|
|
OptionParser.accept(DateTime) do |s,|
|
|
|
|
begin
|
|
|
|
DateTime.parse(s) if s
|
|
|
|
rescue ArgumentError
|
|
|
|
raise OptionParser::InvalidArgument, s
|
|
|
|
end
|
|
|
|
end
|
|
|
|
OptionParser.accept(Date) do |s,|
|
|
|
|
begin
|
2003-09-05 06:32:24 +04:00
|
|
|
Date.parse(s) if s
|
2003-05-21 08:27:06 +04:00
|
|
|
rescue ArgumentError
|
|
|
|
raise OptionParser::InvalidArgument, s
|
|
|
|
end
|
|
|
|
end
|