Method: PropCheck::Generators.past_date
- Defined in:
- lib/prop_check/generators.rb
.past_date(epoch: Date.today) ⇒ Object
variant of #date that only generates dates in the past (relative to :epoch).
>> Generators.past_date(epoch: Date.new(2022, 01, 01)).sample(2, rng: Random.new(42))
=> [Date.new(2021, 12, 27), Date.new(2021, 12, 22)]
751 752 753 |
# File 'lib/prop_check/generators.rb', line 751 def past_date(epoch: Date.today) date_from_offset(negative_integer, epoch: epoch) end |