diff --git a/app/soapbox/components/ui/stack/stack.tsx b/app/soapbox/components/ui/stack/stack.tsx index 1931904b9..fed361e93 100644 --- a/app/soapbox/components/ui/stack/stack.tsx +++ b/app/soapbox/components/ui/stack/stack.tsx @@ -52,7 +52,7 @@ const Stack = React.forwardRef((props, ref: React.Legacy = ({ status }) => { if (event.end_time) { const endDate = new Date(event.end_time); - const sameDay = startDate.getDate() === endDate.getDate() && startDate.getMonth() === endDate.getMonth() && startDate.getFullYear() === endDate.getFullYear(); + const sameYear = startDate.getFullYear() === endDate.getFullYear(); + const sameDay = startDate.getDate() === endDate.getDate() && startDate.getMonth() === endDate.getMonth() && sameYear; if (sameDay) { date = ( <> - + {' - '} diff --git a/app/soapbox/features/event/event-information.tsx b/app/soapbox/features/event/event-information.tsx index 9068d2d5c..54c5f5f40 100644 --- a/app/soapbox/features/event/event-information.tsx +++ b/app/soapbox/features/event/event-information.tsx @@ -88,7 +88,12 @@ const EventInformation: React.FC = ({ params }) => { const renderEventDate = useCallback(() => { const event = status?.event; - if (!event?.start_time) return null; + const startDate = new Date(event.start_time); + const endDate = new Date(event.end_time); + + if (!startDate) return null; + + const sameDay = endDate && startDate.getDate() === endDate.getDate() && startDate.getMonth() === endDate.getMonth() && startDate.getFullYear() === endDate.getFullYear(); return ( @@ -98,10 +103,26 @@ const EventInformation: React.FC = ({ params }) => { - - {event.end_time && (<> + + {endDate && (<> {' - '} - + )}