aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-04-15 10:54:13 +0200
committerChocobozzz <me@florianbigard.com>2022-04-15 10:54:13 +0200
commitb3f84d8ddb91c2a830fdef3a32c3ef1d4fe43886 (patch)
tree2ffe61082cec4e9b78d91a02e6eba16c090407dc
parent1222a602a3e23635505c3c78e0470a5b5a7a2cd8 (diff)
downloadPeerTube-b3f84d8ddb91c2a830fdef3a32c3ef1d4fe43886.tar.gz
PeerTube-b3f84d8ddb91c2a830fdef3a32c3ef1d4fe43886.tar.zst
PeerTube-b3f84d8ddb91c2a830fdef3a32c3ef1d4fe43886.zip
Include upper boundary on stats graph zoom
-rw-r--r--client/src/app/+stats/video/video-stats.component.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/client/src/app/+stats/video/video-stats.component.ts b/client/src/app/+stats/video/video-stats.component.ts
index 14db31ecf..8200661c3 100644
--- a/client/src/app/+stats/video/video-stats.component.ts
+++ b/client/src/app/+stats/video/video-stats.component.ts
@@ -316,7 +316,7 @@ export class VideoStatsComponent implements OnInit {
316 const { min, max } = chart.scales.x 316 const { min, max } = chart.scales.x
317 317
318 const startDate = rawData.data[min].date 318 const startDate = rawData.data[min].date
319 const endDate = rawData.data[max].date 319 const endDate = this.buildZoomEndDate(rawData.groupInterval, rawData.data[max].date)
320 320
321 this.peertubeRouter.silentNavigate([], { startDate, endDate }) 321 this.peertubeRouter.silentNavigate([], { startDate, endDate })
322 } 322 }
@@ -449,4 +449,19 @@ export class VideoStatsComponent implements OnInit {
449 } 449 }
450 } 450 }
451 } 451 }
452
453 private buildZoomEndDate (groupInterval: string, last: string) {
454 const date = new Date(last)
455
456 // Remove parts of the date we don't need
457 if (groupInterval.endsWith(' day') || groupInterval.endsWith(' days')) {
458 date.setHours(23, 59, 59)
459 } else if (groupInterval.endsWith(' hour') || groupInterval.endsWith(' hours')) {
460 date.setMinutes(59, 59)
461 } else {
462 date.setSeconds(59)
463 }
464
465 return date.toISOString()
466 }
452} 467}