From 16ff92dbb51cc51b6b9393f509d53d54835d43f0 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 4 Dec 2020 01:29:49 +0300
Subject: feat: add timestamp to logs

---
 src/components/EventCard/Logs.tsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'src/components/EventCard/Logs.tsx')

diff --git a/src/components/EventCard/Logs.tsx b/src/components/EventCard/Logs.tsx
index f508c16..d78fbd8 100644
--- a/src/components/EventCard/Logs.tsx
+++ b/src/components/EventCard/Logs.tsx
@@ -6,12 +6,17 @@ interface PropTypes {
   eventId: string;
 }
 
+const DATE_OPTIONS = { dateStyle: 'short' };
 
 const Logs: React.FC<PropTypes> = ({ eventId }) => {
   const { data: logs } = useEventLogs(eventId);
-  const logString = '```\n' + logs?.map(log => log.message).join('\n') + '\n```';
 
-  return <Markdown data={logString} />;
+  const logString = logs?.map(log => {
+    const timestamp = new Date(log.createdAt).toLocaleTimeString();
+    return `[${timestamp}] ${log.message}`;
+  }).join('\n');
+
+  return <Markdown data={'```\n' + logString + '\n```'} />;
 };
 
 export default Logs;
-- 
cgit v1.2.3

