added timezone settings

This commit is contained in:
dohsimpson
2025-01-01 22:38:45 -05:00
parent 3ac67ca413
commit 11ea0ff89e
17 changed files with 251 additions and 15 deletions

View File

@@ -0,0 +1,26 @@
'use client'
import { useEffect, useState } from 'react'
import moment from 'moment-timezone'
interface DynamicTimeProps {
timezone: string
}
export function DynamicTime({ timezone }: DynamicTimeProps) {
const [time, setTime] = useState(moment())
useEffect(() => {
const timer = setInterval(() => {
setTime(moment())
}, 1000)
return () => clearInterval(timer)
}, [])
return (
<div className="text-sm text-muted-foreground">
{time.tz(timezone).format('dddd, MMMM D, YYYY h:mm:ss A')}
</div>
)
}