What is the best way to generate a random DateTime in Ruby/Rails? Trying to create a nice seeds.rb file. Going to use it like so:
Foo.create(name: Faker::Lo
Another approach using DateTime's advance
def rand_date # return a random date within 100 days of today in both past and future directions. n = rand(-100..100) Date.today.advance(days: n) end