From 5c0691d8d65d61f1183419f664df9775d8bcb3f4 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 24 Mar 2024 13:00:42 +0000 Subject: [PATCH] Adds a timestamp to date util --- web/src/utils/dates-n-stuff.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/src/utils/dates-n-stuff.ts b/web/src/utils/dates-n-stuff.ts index 0669bee..a89fb57 100644 --- a/web/src/utils/dates-n-stuff.ts +++ b/web/src/utils/dates-n-stuff.ts @@ -6,6 +6,15 @@ export const formatDate = (date: string): string => { }); } +export const timestampToDate = (timestamp: number): string => { + return new Date(timestamp).toLocaleDateString('en-GB', { + day: '2-digit', + month: 'short', + year: '2-digit' + }); + +} + export const timeAgo = (dateStr: string): string => { const seconds = Math.floor((new Date().getTime() - new Date(dateStr).getTime()) / 1000); const intervals = {