Skip to content

Commit

Permalink
🐛 Set max time for event filter to next day to avoid timezone issues (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
foysalit authored Feb 12, 2024
1 parent 65cd2ba commit 266be36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion components/mod-event/EventList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { MOD_EVENTS, MOD_EVENT_TITLES } from './constants'
import { ArchiveBoxXMarkIcon, ChevronDownIcon } from '@heroicons/react/20/solid'
import { getSubjectTitle } from './helpers/subject'
import { useState } from 'react'
import { addDays } from 'date-fns'
import { Checkbox, FormLabel, Input } from '@/common/forms'
import { ActionButton } from '@/common/buttons'
import { FunnelIcon as FunnelEmptyIcon } from '@heroicons/react/24/outline'
Expand Down Expand Up @@ -380,7 +381,7 @@ const EventFilterPanel = ({
}
autoComplete="off"
min={FIRST_EVENT_TIMESTAMP}
max={formatDateForInput(new Date())}
max={formatDateForInput(addDays(new Date(), 1))}
/>
</FormLabel>

Expand Down
6 changes: 3 additions & 3 deletions components/mod-event/useModEventList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useContext, useEffect, useReducer, useState } from 'react'
import { AuthContext } from '@/shell/AuthContext'
import { ComAtprotoAdminQueryModerationEvents } from '@atproto/api'
import { MOD_EVENT_TITLES } from './constants'
import { endOfDay } from 'date-fns'
import { addDays } from 'date-fns'

export type ModEventListQueryOptions = {
queryOptions?: {
Expand Down Expand Up @@ -32,7 +32,7 @@ const initialListState = {
createdBy: undefined,
subject: undefined,
oldestFirst: false,
createdBefore: formatDateForInput(endOfDay(new Date())),
createdBefore: formatDateForInput(addDays(new Date(), 1)),
createdAfter: FIRST_EVENT_TIMESTAMP,
reportTypes: [],
addedLabels: [],
Expand Down Expand Up @@ -243,4 +243,4 @@ async function getModerationEvents(
{ headers: client.adminHeaders() },
)
return data
}
}

0 comments on commit 266be36

Please sign in to comment.