fzaninotto/Faker

[BUG] dateTimeThisYear method does not generate a properly date with current year

didix16 opened this issue · 0 comments

Summary

Hi, like title says, I'm using the method dateTimeThisYear() to generate a date from current year but, sometimes is generating a date from previous year!

Versions

Version
PHP 7.4.5
fzaninotto/faker ^1.4

Self-enclosed code snippet for reproduction

for($i = 0; $i < 100; $i++) {
    $y = $faker->dateTimeThisYear()->format("Y");

    if ($y != "2020") {
        throw new \Exception("FAKER ERROR. Generated year: ". $y);
    }
}

Expected output

It should not generate an Exception.

Actual output

FAKER ERROR. Generated year: 2019