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

'console usercountry:attribute' always returns Date Format Exception #13452

Closed
Flightkick opened this issue Sep 19, 2018 · 1 comment
Closed
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@Flightkick
Copy link

I'm trying to re-index the visitors geolocations but console command always returns invalid date format.

$ php console usercountry:attribute dates-range=2018-08-22,2018-09-19

  [Exception]
  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):

usercountry:attribute [--percent-step="..."] [--provider="..."] [--segment-limit[="..."]] [--force] dates-range

I tried the following combinations to no avail (always showing above exception):

php console usercountry:attribute dates-range="2018-08-22,2018-09-19"

php console usercountry:attribute "dates-range=2018-08-22,2018-09-19"

php console usercountry:attribute dates-range="2018-08-22,2018-09-19"

php console usercountry:attribute dates-range=yesterday,today

php console usercountry:attribute dates-range='yesterday','today'

php console usercountry:attribute dates-range='yesterday','today'

php console usercountry:attribute dates-range="'yesterday','today'"

php console usercountry:attribute dates-range="'yesterday','today'"

php console usercountry:attribute dates-range="'yesterday','today'"

I found the related function but wasn't able to dig deeper.

private function getDateRangeToAttribute(InputInterface $input)
{
$dateRangeString = $input->getArgument(self::DATES_RANGE_ARGUMENT);
$dates = explode(',', $dateRangeString);
$dates = array_map(array('Piwik\Date', 'factory'), $dates);
if (count($dates) != 2) {
throw new \InvalidArgumentException('Invalid date range supplied: ' . $dateRangeString);
}
return $dates;
}

Additional info:
Matomo-version: 3.6.0
PHP-version: 7.2.9-1+ubuntu16.04.1+deb.sury.org+1

@Flightkick
Copy link
Author

I fixed the issue. I stumbled upon the command syntax from here: https://issues.matomo.org/6146

Appearently, i was supposed to omit the date-range= argument and just post the dates:

php console usercountry:attribute 2018-01-01,2019-01-01

Worked.

@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants