mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
26 lines
No EOL
566 B
TypeScript
26 lines
No EOL
566 B
TypeScript
import { FaClock } from 'react-icons/fa';
|
|
import { dayjs } from 'components/dayjs'
|
|
import { useEffect, useState } from 'react'
|
|
import styles from 'styles/Home.module.scss'
|
|
|
|
const now = () => dayjs().tz()
|
|
|
|
const format = 'hhA'
|
|
|
|
const Time = () => {
|
|
const [date, setDate] = useState(now())
|
|
|
|
useEffect(() => {
|
|
const timer = setInterval(() => setDate(now()), 1000)
|
|
return () => clearInterval(timer)
|
|
}, [])
|
|
|
|
return (
|
|
<p className={styles.time}>
|
|
<FaClock />
|
|
{' '}{date.format('DD/MM/YYYY • h:mm:ss A')}
|
|
</p>
|
|
)
|
|
}
|
|
|
|
export default Time |