Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Set max time for event filter to next day to avoid timezone issues #27

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading