Skip to content

Commit

Permalink
fix(twitch): correctly calculate clips period in days
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Nov 11, 2021
1 parent a83b4ce commit d830648
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/twitch/calls/getTopClips.ts
@@ -1,3 +1,5 @@
import { DAY } from '@sogebot/ui-helpers/constants';

import { HelixClip } from '../../../../node_modules/@twurple/api/lib';
import client from '../api/client';
import { getGameNameFromId } from './getGameNameFromId';
Expand All @@ -12,7 +14,7 @@ export async function getTopClips (opts: any) {
const period = {
startDate: opts.period === 'stream'
? (new Date(streamStatusChangeSince.value)).toISOString()
: (new Date((new Date()).setDate(-Math.min(opts.days, 0)))).toISOString(),
: new Date(Date.now() - opts.days * DAY).toISOString(),
endDate: (new Date()).toISOString(),
};

Expand Down

0 comments on commit d830648

Please sign in to comment.