diff options
Diffstat (limited to 'client/src/app/+stats')
-rw-r--r-- | client/src/app/+stats/video/video-stats.component.ts | 17 |
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 | } |