diff --git a/components/bin/GalleryPosts.js b/components/bin/GalleryPosts.js
index bbd14b0b..a96bd9b0 100644
--- a/components/bin/GalleryPosts.js
+++ b/components/bin/GalleryPosts.js
@@ -3,7 +3,7 @@ import styles from '../../public/bin/style/gallery.module.css'
import { useEffect, useRef, useState } from 'react';
-const BinPost = ({title = "Bin Post", desc = "Bin Project", slack = '', link = '', images = [], id}) => {
+const BinPost = ({title = "Bin Post", desc = "Bin Project", slack = '', link = '', id, date}) => {
link = link.trim();
if (!/^https?:\/\//i.test(link)) {
@@ -22,6 +22,24 @@ const BinPost = ({title = "Bin Post", desc = "Bin Project", slack = '', link = '
}
}
+ function formatDate(dateString) {
+ console.log("date", date)
+ const inputDate = new Date(dateString);
+ const now = new Date();
+ const oneDay = 24 * 60 * 60 * 1000; // Number of milliseconds in one day
+
+ // Check if the input date is within the last 24 hours
+ if (now - inputDate < oneDay) {
+ const hours = inputDate.getHours().toString().padStart(2, '0');
+ const minutes = inputDate.getMinutes().toString().padStart(2, '0');
+ return `Today at ${hours}:${minutes}`;
+ } else {
+ // Format the date to "Month day, year"
+ const options = { year: 'numeric', month: 'long', day: 'numeric' };
+ return inputDate.toLocaleDateString(undefined, options);
+ }
+ }
+
return (
@@ -34,7 +52,9 @@ return (
{desc}
- {slack ? (slack.startsWith('@') ? (slack) : (`@${slack}`)) : ("")}
+ {(slack ? (slack.startsWith('@') ? (slack) : (`@${slack}`)) : (""))+ " "}
+ {formatDate(date)}
+
)
diff --git a/components/bin/footer.js b/components/bin/footer.js
index 79e7b4f6..410e25ba 100644
--- a/components/bin/footer.js
+++ b/components/bin/footer.js
@@ -67,19 +67,19 @@ const Footer = () => {
-
-
-
-
-
-
-
-