Skip to content

Commit

Permalink
fix(twitchStreams): subtract 1 day from date for monthly stats (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
wopian authored Apr 1, 2023
1 parent f7192c3 commit dcd348e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/database/twitchStreams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isFirstDayOfMonth, startOfMonth } from 'date-fns'
import { isFirstDayOfMonth, startOfMonth, subDays } from 'date-fns'
import { Message } from 'discord.js'

import { DatabaseStream, TwitchStats } from '../../models/twitch.js'
Expand Down Expand Up @@ -44,7 +44,7 @@ export const getMonthlyUserStreams = async (userId: string) => {

export const getMonthlyStats = async () => {
const now = Date.now()
const firstDayOfMonth = startOfMonth(now)
const firstDayOfMonth = startOfMonth(subDays(now, 1))

// Skip if it's not the first day of the month
if (!isFirstDayOfMonth(now)) return
Expand Down

0 comments on commit dcd348e

Please sign in to comment.