|
|
|
@ -6,14 +6,12 @@ import { |
|
|
|
} from 'react' |
|
|
|
} from 'react' |
|
|
|
import { useLocation } from 'react-router-dom' |
|
|
|
import { useLocation } from 'react-router-dom' |
|
|
|
|
|
|
|
|
|
|
|
import format from 'date-fns/format' |
|
|
|
|
|
|
|
import startOfDay from 'date-fns/startOfDay' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { SportTypes } from 'config' |
|
|
|
import { SportTypes } from 'config' |
|
|
|
|
|
|
|
|
|
|
|
import { useQueryParamStore } from 'hooks' |
|
|
|
import { useQueryParamStore } from 'hooks' |
|
|
|
|
|
|
|
|
|
|
|
import { filterKeys } from '../config' |
|
|
|
import { filterKeys } from '../config' |
|
|
|
|
|
|
|
import { getMoscowDate } from '../helpers/getMoscowDate' |
|
|
|
import { isValidDate } from '../helpers/isValidDate' |
|
|
|
import { isValidDate } from '../helpers/isValidDate' |
|
|
|
import { isValidSportType } from '../helpers/isValidSportType' |
|
|
|
import { isValidSportType } from '../helpers/isValidSportType' |
|
|
|
import { isValidMatchStatus } from '../helpers/isValidMatchStatus' |
|
|
|
import { isValidMatchStatus } from '../helpers/isValidMatchStatus' |
|
|
|
@ -24,8 +22,6 @@ export enum MatchStatuses { |
|
|
|
Soon = 1, |
|
|
|
Soon = 1, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const dateFormat = 'dd/MM/yyyy HH:mm:ss' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const useFilters = () => { |
|
|
|
export const useFilters = () => { |
|
|
|
const { search } = useLocation() |
|
|
|
const { search } = useLocation() |
|
|
|
const [selectedDate, setSelectedDate] = useQueryParamStore({ |
|
|
|
const [selectedDate, setSelectedDate] = useQueryParamStore({ |
|
|
|
@ -90,7 +86,7 @@ export const useFilters = () => { |
|
|
|
|
|
|
|
|
|
|
|
const store = useMemo(() => ({ |
|
|
|
const store = useMemo(() => ({ |
|
|
|
selectedDate, |
|
|
|
selectedDate, |
|
|
|
selectedDateFormatted: format(startOfDay(selectedDate), dateFormat), |
|
|
|
selectedDateFormatted: getMoscowDate(selectedDate), |
|
|
|
selectedMatchStatus, |
|
|
|
selectedMatchStatus, |
|
|
|
selectedSportTypeId, |
|
|
|
selectedSportTypeId, |
|
|
|
selectedTournamentId, |
|
|
|
selectedTournamentId, |
|
|
|
|