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:
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