diff --git a/src/utils/formatDatetime.ts b/src/utils/formatDatetime.ts new file mode 100644 index 0000000..60791ac --- /dev/null +++ b/src/utils/formatDatetime.ts @@ -0,0 +1,14 @@ +const formatDatetime = (datetime: string) => { + const myDatetime = new Date(datetime); + return ( + myDatetime.toLocaleDateString([], { + year: "numeric", + month: "long", + day: "numeric", + }) + + " | " + + myDatetime.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) + ); +}; + +export default formatDatetime;