Skip to content

Commit

Permalink
update time formatting in message component
Browse files Browse the repository at this point in the history
  • Loading branch information
firehawk89 committed Sep 24, 2023
1 parent 90f50c4 commit d4e8038
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/message.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import getFormattedTime from '@/utils/getFormattedDate'
import { useEffect, useState } from 'react'
import { timeFormatter } from '@/utils/getFormattedDate'
import Image from 'next/image'
import Link from 'next/link'

export default function Message({ sentAt, children }) {
const [time, setTime] = useState(0)
const { format: formatTime } = timeFormatter()

useEffect(() => {
setTime(formatTime(sentAt))
}, [sentAt, formatTime])

return (
<div className="flex items-end gap-2">
<Link className="rounded-full overflow-hidden" href="/">
Expand Down

0 comments on commit d4e8038

Please sign in to comment.