yossi
yossi

Reputation: 3164

Why the `fake()->dateTimeBetween` is not working as expected?

In my factory seeder i'm using this code.
but it's not working as expected, and the results are with random (up to one month) difference.
Why?

$start = fake()->dateTimeThisMonth();
$end = fake()->dateTimeBetween($start, '+1 day');

Up to one day difference, when the $start is the min'

Upvotes: 0

Views: 339

Answers (1)

dlnsk
dlnsk

Reputation: 114

Using ordinary DateTime class

$start = fake()->dateTimeThisMonth();
$end = (clone $start)->add(new DateInterval('P1D'));

Upvotes: 1

Related Questions