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

Limit date ranges that end far in the future #22592

Merged
merged 4 commits into from
Sep 24, 2024
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Sep 16, 2024

Description:

Matomo currently only restricts provided dates in the past. A date currently can't be set to earlier than August 1991 - the date were the first website went live.

Future dates are currently not restricted, even though it doesn't make sense to provide dates that are far in the future. As Matomo won't archive future dates, there can't be any data returned anyway.

Providing single periods like day, week, month or year far in the future is unproblematic, as Matomo would simply display no data for it.

Range periods and multiple period requests however are a bit different, as Matomo would try to process all subperiods that are included. As dates in the future can't have any data anyway, there is not much value in even trying to process those dates unlimited.
Therefor this PR introduces an internal limit for range periods. If a range is provided with an end date that is more than 10 years in the future, Matomo will automatically cut down the range to end at end of the current year + 10 years.

Review

@sgiehl sgiehl added c: Usability For issues that let users achieve a defined goal more effectively or efficiently. c: Dates & Calendar For bugs and features in date range selections, calendar UI, and report frequency. labels Sep 16, 2024
@sgiehl sgiehl added this to the 5.2.0 milestone Sep 16, 2024
@sgiehl sgiehl force-pushed the disallowfuturedates branch 2 times, most recently from 007a431 to a72d66c Compare September 16, 2024 16:41
@sgiehl sgiehl changed the title Improve handling of provided dates that are far in the future Sep 18, 2024
@sgiehl sgiehl marked this pull request as ready for review September 18, 2024 15:14
@sgiehl sgiehl added the Needs Review PRs that need a code review label Sep 18, 2024
@sgiehl sgiehl requested a review from a team September 18, 2024 15:28
@sgiehl sgiehl requested a review from a team September 20, 2024 15:55
core/Period/Range.php Outdated Show resolved Hide resolved
Co-authored-by: Marc Neudert <marc@innocraft.com>
@sgiehl sgiehl merged commit ec8cf14 into 5.x-dev Sep 24, 2024
25 checks passed
@sgiehl sgiehl deleted the disallowfuturedates branch September 24, 2024 16:43
sgiehl added a commit that referenced this pull request Sep 25, 2024
* Limit the end date of range periods to 10 years in the future

* Mark method as api

* Apply review feedback

Co-authored-by: Marc Neudert <marc@innocraft.com>

---------

Co-authored-by: Michal Kleiner <michal@innocraft.com>
Co-authored-by: Marc Neudert <marc@innocraft.com>
sgiehl added a commit that referenced this pull request Sep 25, 2024
* Limit the end date of range periods to 10 years in the future

* Mark method as api

* Apply review feedback



---------

Co-authored-by: Michal Kleiner <michal@innocraft.com>
Co-authored-by: Marc Neudert <marc@innocraft.com>
Co-authored-by: caddoo <matthew.caddoo@gmail.com>
jorgeuos pushed a commit to jorgeuos/matomo that referenced this pull request Oct 1, 2024
* Limit the end date of range periods to 10 years in the future

* Mark method as api

* Apply review feedback

Co-authored-by: Marc Neudert <marc@innocraft.com>

---------

Co-authored-by: Michal Kleiner <michal@innocraft.com>
Co-authored-by: Marc Neudert <marc@innocraft.com>
sgiehl added a commit that referenced this pull request Oct 10, 2024
* Limit the end date of range periods to 10 years in the future

* Mark method as api

* Apply review feedback

Co-authored-by: Marc Neudert <marc@innocraft.com>

---------

Co-authored-by: Michal Kleiner <michal@innocraft.com>
Co-authored-by: Marc Neudert <marc@innocraft.com>
mneudert added a commit that referenced this pull request Oct 10, 2024
* Limit the end date of range periods to 10 years in the future

* Mark method as api

* Apply review feedback



---------

Co-authored-by: Michal Kleiner <michal@innocraft.com>
Co-authored-by: Marc Neudert <marc@innocraft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Dates & Calendar For bugs and features in date range selections, calendar UI, and report frequency. c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Needs Review PRs that need a code review
3 participants