Method: PropCheck::Generators.past_datetime

Defined in:
lib/prop_check/generators.rb

.past_datetime(epoch: nil) ⇒ Object

Variant of ‘#datetime` that only generates datetimes in the past (relative to `:epoch`).

>> PropCheck::Generators.past_datetime(epoch: Date.new(2022, 11, 20)).sample(2, rng: Random.new(42), config: PropCheck::Property::Configuration.new)
=> [DateTime.parse("2022-11-17 07:11:59.999983907 +0000"), DateTime.parse("2022-11-19 05:27:16.363618076 +0000")]

799
800
801
# File 'lib/prop_check/generators.rb', line 799

def past_datetime(epoch: nil)
  datetime_from_offset(real_negative_float, epoch: epoch)
end