Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error message in API/UI if date is before 1992 (#12559) #12561

Merged
merged 5 commits into from Feb 26, 2018
Merged

Update error message in API/UI if date is before 1992 (#12559) #12561

merged 5 commits into from Feb 26, 2018

Conversation

simivar
Copy link
Contributor

@simivar simivar commented Feb 15, 2018

Update error message in API/UI if date is before 1992 (#12559)

@sgiehl sgiehl added the Needs Review PRs that need a code review label Feb 15, 2018
core/Date.php Outdated
throw self::getInvalidDateFormatException($dateString);

$dateOfFirstWebsite = new self(self::FIRST_WEBSITE_TIMESTAMP);
if ($date->isEarlier($dateOfFirstWebsite)) {
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to not use $timestamp < 681436800 or $timestamp < self::FIRST_WEBSITE_TIMESTAMP? Would make it a wee bit faster as this might be executed quite a few times. Could still create the date within the if block in case the date is actually earlier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, just thought it's gonna be more readable. I'll move that to the if block.

@sgiehl sgiehl added this to the 3.3.1 milestone Feb 26, 2018
@sgiehl
Copy link
Member

sgiehl commented Feb 26, 2018

Looks good now. Thanks for the contribution!

@sgiehl sgiehl merged commit 07b654d into matomo-org:3.x-dev Feb 26, 2018
InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
…) (matomo-org#12561)

* Update error message in API/UI if date is before 1992 (matomo-org#12559)

* Fix test for dates

* Fix test for dates

* Move creation of $dateOfFirstWebsite object to if block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants