]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/stats.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / stats.ts
index 30e2bb06c347f7295a0aeb221c04863b7c49a9e0..e79f01888b99bafa00c82d35ee86e0c2635bb4af 100644 (file)
@@ -67,18 +67,9 @@ async function getTimeserieStats (req: express.Request, res: express.Response) {
   const stats = await LocalVideoViewerModel.getTimeserieStats({
     video,
     metric,
-    startDate: query.startDate ?? buildOneMonthAgo().toISOString(),
+    startDate: query.startDate ?? video.createdAt.toISOString(),
     endDate: query.endDate ?? new Date().toISOString()
   })
 
   return res.json(stats)
 }
-
-function buildOneMonthAgo () {
-  const monthAgo = new Date()
-  monthAgo.setHours(0, 0, 0, 0)
-
-  monthAgo.setDate(monthAgo.getDate() - 29)
-
-  return monthAgo
-}