mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
commit
This commit is contained in:
26
components/Time.tsx
Normal file
26
components/Time.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
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
|
||||
Reference in New Issue
Block a user