From 8dce04b35d65c0b97870f3881ada260657a6aed2 Mon Sep 17 00:00:00 2001 From: Rakov Date: Fri, 8 Sep 2023 13:04:46 +0300 Subject: [PATCH] fix(#720): add timeline timezone --- src/requests/getMatches/getTimelineMatches.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/requests/getMatches/getTimelineMatches.tsx b/src/requests/getMatches/getTimelineMatches.tsx index e6bf2f55..c80919d0 100644 --- a/src/requests/getMatches/getTimelineMatches.tsx +++ b/src/requests/getMatches/getTimelineMatches.tsx @@ -18,7 +18,14 @@ export type MatchesTimeline = { } export const getTimelineMatches = (sportId?: number): Promise => { - const url = new URL(`${API_ROOT}/v1/matches/timeline`) + const getTimezoneOffset = () => { + const offset = new Date().getTimezoneOffset() + if (offset === 0) return offset + return -(offset) + } + const timeZoneOffset = getTimezoneOffset() + + const url = new URL(`${API_ROOT}/v1/broadcasts/timeline/${timeZoneOffset}`) if (sportId) { url.searchParams.append('sport_id', `${sportId}`)