faker-ruby/faker · error · ArgumentError
There is no #{DAYS_OF_WEEK[date.wday].capitalize} between #{
Error message
There is no #{DAYS_OF_WEEK[date.wday].capitalize} between #{from} and #{to}. Increase the from/to date range or choose a different day of the week. What it means
Error "There is no #{DAYS_OF_WEEK[date.wday].capitalize} between #{from} and #{to}. Increase the from/to date range or choose a different day of the week." thrown in faker-ruby/faker.
Source
Thrown at lib/faker/default/date.rb:179
numeric_weekdays = days.map do |d|
DAYS_OF_WEEK.index(d.to_sym.downcase) || raise(ArgumentError, "#{d} is not a valid day of the week")
end
from = get_date_object(from)
to = get_date_object(to)
date = Faker::Base.rand_in_range(from, to)
# If the initial date is not on one of the wanted days of the week...
unless numeric_weekdays.include? date.wday
# ...pick a date nearby that is on one of the wanted days of the week instead
date += sample(numeric_weekdays) - date.wday
# Move date 1 week earlier or later if the adjusted date is now outside the date range
date += 7 if date < from
date -= 7 if date > to
if date > to || date < from
raise ArgumentError,
"There is no #{DAYS_OF_WEEK[date.wday].capitalize} between #{from} and #{to}. Increase the from/to date range or choose a different day of the week."
end
end
date
end
private
def birthday_date(date, age)
year = date.year - age
day =
if date.day == 29 && date.month == 2 && !::Date.leap?(year)
28
else
date.day
endView on GitHub (pinned to cca4184947)
When it happens
Trigger: Thrown at lib/faker/default/date.rb:179 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of faker-ruby/faker@cca4184947 (2026-08-21).
Data as JSON: /api/errors/7aea7548445cc0c1.
Report an issue: GitHub.