diff options
author | eug-vs <eug-vs@keemail.me> | 2020-12-04 01:29:49 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-12-04 01:29:49 +0300 |
commit | 16ff92dbb51cc51b6b9393f509d53d54835d43f0 (patch) | |
tree | 9aac4b6d8c8c044b445b4f48d53275f3802602e0 | |
parent | 2b0d5d2a6db017f5eaeb88a4ec71a9590854e9c3 (diff) | |
download | famcs-kit-16ff92dbb51cc51b6b9393f509d53d54835d43f0.tar.gz |
feat: add timestamp to logs
-rw-r--r-- | src/components/EventCard/Logs.tsx | 9 |
1 files changed, 7 insertions, 2 deletions
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; |