diff --git a/FU.SPA/src/components/PostCard.jsx b/FU.SPA/src/components/PostCard.jsx
index 1bd8bd58..0d562bdb 100644
--- a/FU.SPA/src/components/PostCard.jsx
+++ b/FU.SPA/src/components/PostCard.jsx
@@ -46,6 +46,7 @@ const PostCard = ({ post, showActions, onTagClick, showJoinedStatus }) => {
if (post.startTime) {
let startOfToday = dayjs().startOf('day');
let postStartDateTime = dayjs(post.startTime);
+ let postEndDateTime = dayjs(post.endTime);
let startDate = dayjs(post.startTime).format('MMM D, YYYY');
if (postStartDateTime < startOfToday) {
@@ -60,6 +61,22 @@ const PostCard = ({ post, showActions, onTagClick, showJoinedStatus }) => {
startDate = dayjs(post.startTime).format('MMM D');
}
+ let endDate = '';
+ if (!postEndDateTime.isSame(postStartDateTime, 'day')) {
+ endDate = dayjs(post.endTime).format('MMM D, YYYY');
+ if (postEndDateTime < startOfToday) {
+ // Use default
+ } else if (postEndDateTime < startOfToday.add(1, 'day')) {
+ endDate = 'Today';
+ } else if (postEndDateTime < startOfToday.add(2, 'day')) {
+ endDate = 'Tomorrow';
+ } else if (postEndDateTime < startOfToday.add(6, 'day')) {
+ endDate = dayjs(post.endTime).format('ddd');
+ } else if (postEndDateTime < startOfToday.add(1, 'year')) {
+ endDate = dayjs(post.endTime).format('MMM D');
+ }
+ }
+
var startTime = new Date(post.startTime).toLocaleString('en-US', {
timeStyle: 'short',
});
@@ -67,7 +84,11 @@ const PostCard = ({ post, showActions, onTagClick, showJoinedStatus }) => {
timeStyle: 'short',
});
- dateTimeString = `${startDate}, ${startTime} - ${endTime}`;
+ dateTimeString = `${startDate}, ${startTime} - `;
+ if (endDate !== '') {
+ dateTimeString += `${endDate}, `;
+ }
+ dateTimeString += `${endTime}`;
} else {
dateTimeString = 'No time';
}
@@ -127,9 +148,11 @@ const PostCard = ({ post, showActions, onTagClick, showJoinedStatus }) => {
{post.game}
-
- {dateTimeString}
-
+
+
+ {dateTimeString}
+
+