Ott 723 match date fix (#276)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Andrey Razdorskiy 5 years ago committed by GitHub
parent f24facb684
commit d9467279db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/features/MatchCard/CardFrontside/index.tsx
  2. 2
      src/features/Matches/helpers/prepareMatches.tsx

@ -7,6 +7,7 @@ import { SportName } from 'features/Common'
import { useMatchSwitchesStore } from 'features/MatchSwitches'
import { useName } from 'features/Name'
import { getUnixTime } from 'date-fns'
import { NoAccessMessage } from '../NoAccessMessage'
import {
CardWrapper,
@ -37,12 +38,15 @@ export const CardFrontside = ({
accessibleBySubscription,
accessibleInUsersCountry,
date,
hasVideo,
preview,
sportType,
storage,
team1,
team2,
time,
tournament,
unformattedDate,
},
onClick,
onKeyPress,
@ -50,6 +54,7 @@ export const CardFrontside = ({
}: Props) => {
const tournamentName = useName(tournament)
const { isScoreHidden } = useMatchSwitchesStore()
const unixTimeOfMatch = getUnixTime(new Date(unformattedDate))
return (
<CardWrapper
@ -91,9 +96,13 @@ export const CardFrontside = ({
: (
<MatchDate>
{date}
{unixTimeOfMatch > getUnixTime(new Date()) && (!hasVideo || !storage)
? (
<Time>
{time}
</Time>
)
: null}
</MatchDate>
)}
</PreviewWrapper>

@ -32,10 +32,12 @@ const prepareMatch = ({
preview,
sportName: getSportLexic(sport),
sportType: sport,
storage,
team1,
team2,
time: format(new Date(date), 'HH:mm'),
tournament,
unformattedDate: date,
})
export const prepareMatches = (matches: Array<Match>) => map(

Loading…
Cancel
Save