maybe fix timezones?

This commit is contained in:
2025-04-28 15:51:43 +02:00
parent 140b55dede
commit 65150145de
2 changed files with 78 additions and 57 deletions

View File

@@ -1,3 +1,4 @@
import { TimeZoneProvider } from '@/components/timezone-provider'
import { Button } from '@/components/ui/button'
import {
DropdownMenu,
@@ -24,6 +25,7 @@ export function NextMatchInfoCard({
bestOf,
}: NextMatchInfoCardProps) {
return (
<TimeZoneProvider>
<div className='mt-10 overflow-hidden rounded-xl border bg-card/60 shadow-lg backdrop-blur-sm'>
<div className='flex items-center justify-between gap-4 px-6 py-4'>
<div className={'flex flex-col gap-1'}>
@@ -86,5 +88,6 @@ export function NextMatchInfoCard({
</DropdownMenu>
</div>
</div>
</TimeZoneProvider>
)
}

View File

@@ -0,0 +1,18 @@
'use client'
import { NextIntlClientProvider, useLocale } from 'next-intl'
import { useEffect, useState } from 'react'
export function TimeZoneProvider({ children }: { children: React.ReactNode }) {
const [timeZone, setTimeZone] = useState<string>()
const locale = useLocale()
useEffect(() => {
setTimeZone(Intl.DateTimeFormat().resolvedOptions().timeZone)
}, [])
return (
<NextIntlClientProvider timeZone={timeZone} locale={locale}>
{children}
</NextIntlClientProvider>
)
}