@fdellwing opened this Issue on December 10th 2018 Contributor

https://demo.matomo.org/index.php?module=MultiSites&action=index&idSite=3&period=day&date=last%20week

If you open this link, the datepicker is not present at all, but last week is working as intended.

On dashboard the datepicker is present.

@tsteur commented on December 10th 2018 Member

@fdellwing it's not a supported date format and while it works currently, it is not guaranteed it will work in the future.

@fdellwing commented on December 10th 2018 Contributor

It is supported by strtotime() and that will not change, you even tell the people to look up the php.net article.

Also it should be easy to fix, because you already have a date object, you just need to throw it into the datepicker.

@tsteur commented on December 10th 2018 Member

We still support only couple formats as there are places where we need to detect what kind of date format it is. It's not that easy to support it. I can't even guarantee the data it is showing is correct. Also when you say last week the period would need to be range as multiple dates are not supported by the UI with a non-range period.

@fdellwing commented on December 10th 2018 Contributor

You are aware, of the fact, that "last week" is not a week (strtotime will always return a timestamp and not a range), but the day exactly one week ago?

https://demo.matomo.org/index.php?module=MultiSites&action=index&idSite=3&period=day&date=last%20week
https://demo.matomo.org/index.php?module=MultiSites&action=index&idSite=3&period=day&date=2018-12-03

@tsteur commented on December 10th 2018 Member

Didn't know. It doesn't change too much though sorry. I can leave the issue open if you want and change the title to support this date format in the future.

@mattab commented on March 12th 2019 Member

Thanks for creating this issue. We also got a customer report just today about this. And I'm wishing we have this feature once a month for a few months already :-)

Use case: when doing manual reporting using Matomo numbers, the reporting process can include several links to Matomo reports for "Last month" (documented in a wiki page or spreadsheet.) Currently it is not possible with Matomo to put a static link that will always load last month's data. One can only put a link to a previous month's data and then has to click on it, and manually change date in calendar.

in Matomo when you open a direct link to a report with date=last%20month you get error: Date::factoryInTimezone() should not be used with last month.. If using date=lastmonth can also get the error: Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information):.

in comparison this works well in Woocommerce reports which makes it much easier to report numbers in just a click: https://woocommerce/wp-admin/admin.php?page=wc-reports&tab=customers&range=last_month

in my case for example I have more than 10 Matomo links that i'd like to open the "last month" data automatically. Would save valuable time and remove steps (having to change the date each time is tricky) when date=lastmonth and/or last month is supported. (be good to add this supported value in the API reference page also: http://developer.piwik.org/api-reference/reporting-api )

Powered by GitHub Issue Mirror