class Faker::Date

def between_except(from:, to:, excepted:)

Other tags:
    Example: if used with Rails (Active Support) -
    Example: if used with or without Rails (Active Support) -

Returns:
  • (Date) -

Parameters:
  • excepted (Date, String) -- A date to exclude.
  • to (Date, String) -- The end of the usable date range.
  • from (Date, String) -- The start of the usable date range.
def between_except(from:, to:, excepted:)
  raise ArgumentError, 'From date, to date and excepted date must not be the same' if from == to && to == excepted
  excepted = get_date_object(excepted)
  loop do
    date = between(from: from, to: to)
    break date.to_date if date != excepted
  end
end