diff --git a/package.json b/package.json index b9bcf5d9a97ebf550cca4a8d7e0a25b7ec0d5887..022f684874bb4865bc0656376783757b1c17d518 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webapp", - "version": "2.6.13", + "version": "2.6.14", "license": "GNU Affero General Public License v3.0", "scripts": { "ng": "ng", diff --git a/src/app/dataset-detail/services/usage-statistics.service.ts b/src/app/dataset-detail/services/usage-statistics.service.ts index c87153c64c52e689f959608ada5d34642eae4852..4c650549f2f5866780914c32f45025552117c496 100644 --- a/src/app/dataset-detail/services/usage-statistics.service.ts +++ b/src/app/dataset-detail/services/usage-statistics.service.ts @@ -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(