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

Kz faker random wrong output from getCenturyByYear #2026

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Faker/Provider/kk_KZ/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class Person extends \Faker\Provider\Person
*/
private static function getCenturyByYear($year)
{
if ($year >= 2000 && $year <= DateTime::year()) {
if ($year >= 2000 && $year <= date('Y')) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dont delete && $year <= date('Y') ?

Copy link

@jevgenijsblaus jevgenijsblaus Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To not run into a future I believe. We don't know why this statement exists, but I believe author know what is it for.
The only thing @maris-liepins-ermac did is switching from "Faker" DateTime with random year output to real DateTime year output

return self::CENTURY_21ST;
} elseif ($year >= 1900) {
return self::CENTURY_20TH;
Expand Down