matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.68k stars 2.62k forks source link

Limit date ranges that end far in the future #22592

Open sgiehl opened 5 days ago

sgiehl commented 5 days ago

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