From a6a6738e4b8185422d1a02b1a3c6691d0672d367 Mon Sep 17 00:00:00 2001 From: Guillaume Dorce Date: Fri, 30 Sep 2022 12:32:29 +0200 Subject: [PATCH] fix date format --- client/src/components/Message.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/client/src/components/Message.tsx b/client/src/components/Message.tsx index dba854d..76e02f0 100644 --- a/client/src/components/Message.tsx +++ b/client/src/components/Message.tsx @@ -2,7 +2,7 @@ import { FaThumbsUp } from 'react-icons/fa'; import Avatar from '@components/Avatar'; import PopupMenu from './PopupMenu'; -const Image = ({ image }: {image: string}) => { +const Image = ({ image }: { image: string }) => { if (image === '' || image === null) { return null; } @@ -14,14 +14,14 @@ const Image = ({ image }: {image: string}) => { ); }; -const Text = ({ text }: {text: string}) => { +const Text = ({ text }: { text: string }) => { if (text === '') { return null; } return
{text}
; }; -const Likes = ({ likes }: {likes: number}) => { +const Likes = ({ likes }: { likes: number }) => { return (
@@ -32,7 +32,10 @@ const Likes = ({ likes }: {likes: number}) => { const Message = ({ message }: any) => { return ( <> -
+
{message.author && }
@@ -43,10 +46,17 @@ const Message = ({ message }: any) => {
-
{message.createdAt}
+
+ {new Date(message.createdAt).toLocaleDateString(undefined, { + year: 'numeric', + month: 'long', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + })} +
-
);