From f40712abbbb74e51f06037ef02757c42736bccf8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 6 May 2022 14:23:02 +0200 Subject: Add ability to filter overall video stats by date --- server/controllers/api/videos/stats.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/videos/stats.ts b/server/controllers/api/videos/stats.ts index 30e2bb06c..e79f01888 100644 --- a/server/controllers/api/videos/stats.ts +++ b/server/controllers/api/videos/stats.ts @@ -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 -} -- cgit v1.2.3