mirror of
https://github.com/ershisan99/www.git
synced 2025-12-17 12:34:17 +00:00
maybe fix timezones?
This commit is contained in:
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
18
src/components/timezone-provider.tsx
Normal file
18
src/components/timezone-provider.tsx
Normal 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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user