Skip to content
Snippets Groups Projects
Commit 79a205c3 authored by Dimitri DI GUSTO's avatar Dimitri DI GUSTO
Browse files

Make statistics query paramaters end and start date works in january

parent c296d483
Branches
Tags
1 merge request!112DOS0089064
......@@ -19,12 +19,12 @@ export class UsageStatisticsService {
// However the months in javascript dates goes from 0 to 11 so when passing start and end dates, we don't need to subsctract a month
// The backend service expect a 2 digits month while javascript date does not give 'O1' but only '1'. This is while we use a small trick
// to make sure there always two digits for the month in the date
const monthListArray = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
const today = new Date();
const aMonthAgo = `${today.getFullYear()}-${`0${today.getMonth()}`.slice(-2)}-${today.getDate()}`;
today.setMonth(today.getMonth() - 1);
const aMonthAgo = `${today.getFullYear()}-${monthListArray[today.getMonth()]}-${today.getDate()}`;
today.setFullYear(today.getFullYear() - 1);
const aMonthAndAYearAgo = `${today.getFullYear()}-${`0${today.getMonth()}`.slice(-2)}-${today.getDate()}`;
const aMonthAndAYearAgo = `${today.getFullYear()}-${monthListArray[today.getMonth()]}-${today.getDate()}`;
const url = `${APP_CONFIG.backendUrls.datasetUsageStatistics}?start=${aMonthAndAYearAgo}&uuid=${uuid}&granularity=month&end=${aMonthAgo}`;
return this._httpClient.get(url).pipe(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment