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

Allow using last (week|month|year) as date param #16830

Merged
merged 7 commits into from Dec 10, 2020
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Nov 27, 2020

Description:

Using one those values actually won't directly pass them to strtotime, as it might have imho unexpected results. last week passed to strtotime for example always returns the monday of the previous week. Instead I guess it would be expected to result in the day 7 days ago. Similar applies to last month and year.

For last month there are still some edge cases on the last day of a month when the previous month didn't have that much days.

E.g. last month on 31th Dezember would return 1st Dezember

fixes #13818

Review

  • Functional review done
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Nov 27, 2020
@sgiehl sgiehl added this to the 4.1.0 milestone Nov 27, 2020
@diosmosis
Copy link
Member

@mattab / @tsteur would we need to update documentation anywhere for this?

@diosmosis
Copy link
Member

diosmosis commented Dec 1, 2020

Should these be usable in the API? If so, would it be good to have a system test or two for them?

@diosmosis
Copy link
Member

Tested locally, works well, tested comparison + export links. Left one other test related comment, otherwise lgtm

@tsteur
Copy link
Member

tsteur commented Dec 1, 2020

Yes be great to document here if it's supported in the API https://developer.matomo.org/api-reference/reporting-api

@sgiehl
Copy link
Member Author

sgiehl commented Dec 1, 2020

@diosmosis it actually wasn't possible to use those as api params. at least the results were incorrect.
I've added a new commit to make that possible. It also fixes the usage when period=range.
Also added some system tests.

sgiehl added a commit to matomo-org/developer-documentation that referenced this pull request Dec 1, 2020
Copy link
Member

@diosmosis diosmosis left a comment

Choose a reason for hiding this comment

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

Left one more minor comment, otherwise LGTM

@diosmosis diosmosis merged commit 7cde69f into 4.x-dev Dec 10, 2020
@diosmosis diosmosis deleted the dateformats branch December 10, 2020 02:18
sgiehl added a commit that referenced this pull request Dec 23, 2020
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 not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support date format last week, last month, last year
3 participants