fix(#2411): fix date for work in safari

keep-around/59ca80f9236e3129917c4dfb65a3e5046fde6d4a
Andrei Dekterev 4 years ago
parent a1250dde69
commit 59ca80f923
  1. 2
      src/features/JoinMatchPage/hooks.tsx
  2. 5
      src/features/Matches/helpers/getMatchClickAction/index.tsx

@ -29,6 +29,8 @@ export const useUnauthenticatedMatch = () => {
useEffect(() => {
getUnauthenticatedMatch(sportType, matchId).then(setMatchInfo)
return () => setMatchInfo(null)
}, [sportType, matchId])
return {

@ -17,13 +17,16 @@ export const getMatchAccess = ({
storage,
sub,
}: Match) => {
const dateToMs = Date.parse(date?.replace(/ /, 'T')) // без замены не будет работать в сафари
const dateNowMin10 = dateToMs - 10 * 60 * 1000
switch (true) {
case !sub:
return MatchAccess.CanBuyMatch
case !access:
return MatchAccess.NoCountryAccess
// проверка времени матча - 10минут
case ((new Date(Date.parse(date.toString()) - 10 * 60 * 1000) < new Date()) && !live):
case ((new Date(dateNowMin10) < new Date()) && !live):
return MatchAccess.RedirectToProfile
case live:
return MatchAccess.ViewMatchPopup

Loading…
Cancel
Save