Skip to content

Commit 266be36

Browse files
authored
🐛 Set max time for event filter to next day to avoid timezone issues (#27)
1 parent 65cd2ba commit 266be36

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

components/mod-event/EventList.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { MOD_EVENTS, MOD_EVENT_TITLES } from './constants'
1212
import { ArchiveBoxXMarkIcon, ChevronDownIcon } from '@heroicons/react/20/solid'
1313
import { getSubjectTitle } from './helpers/subject'
1414
import { useState } from 'react'
15+
import { addDays } from 'date-fns'
1516
import { Checkbox, FormLabel, Input } from '@/common/forms'
1617
import { ActionButton } from '@/common/buttons'
1718
import { FunnelIcon as FunnelEmptyIcon } from '@heroicons/react/24/outline'
@@ -380,7 +381,7 @@ const EventFilterPanel = ({
380381
}
381382
autoComplete="off"
382383
min={FIRST_EVENT_TIMESTAMP}
383-
max={formatDateForInput(new Date())}
384+
max={formatDateForInput(addDays(new Date(), 1))}
384385
/>
385386
</FormLabel>
386387

components/mod-event/useModEventList.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useContext, useEffect, useReducer, useState } from 'react'
44
import { AuthContext } from '@/shell/AuthContext'
55
import { ComAtprotoAdminQueryModerationEvents } from '@atproto/api'
66
import { MOD_EVENT_TITLES } from './constants'
7-
import { endOfDay } from 'date-fns'
7+
import { addDays } from 'date-fns'
88

99
export type ModEventListQueryOptions = {
1010
queryOptions?: {
@@ -32,7 +32,7 @@ const initialListState = {
3232
createdBy: undefined,
3333
subject: undefined,
3434
oldestFirst: false,
35-
createdBefore: formatDateForInput(endOfDay(new Date())),
35+
createdBefore: formatDateForInput(addDays(new Date(), 1)),
3636
createdAfter: FIRST_EVENT_TIMESTAMP,
3737
reportTypes: [],
3838
addedLabels: [],
@@ -243,4 +243,4 @@ async function getModerationEvents(
243243
{ headers: client.adminHeaders() },
244244
)
245245
return data
246-
}
246+
}

0 commit comments

Comments
 (0)