Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

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

Open
didix16 opened this issue Jul 13, 2020 · 0 comments

Comments

@didix16
Copy link

didix16 commented Jul 13, 2020

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant