Method: PropCheck::Generators.datetime
- Defined in:
- lib/prop_check/generators.rb
.datetime(epoch: nil) ⇒ Object
Generates DateTime objects. DateTimes start around the given epoch: and deviate more when size increases. when no epoch is set, PropCheck::Property::Configuration.default_epoch is used, which defaults to DateTime.now.
>> PropCheck::Generators.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")]
773 774 775 |
# File 'lib/prop_check/generators.rb', line 773 def datetime(epoch: nil) datetime_from_offset(real_float, epoch: epoch) end |