import React from 'react'; import { FormattedDate } from 'react-intl'; import Icon from 'soapbox/components/icon'; import { HStack } from 'soapbox/components/ui'; import type { Status as StatusEntity } from 'soapbox/types/entities'; interface IEventDate { status: StatusEntity, } const EventDate: React.FC = ({ status }) => { const event = status.event!; if (!event.start_time) return null; const startDate = new Date(event.start_time); let date; if (event.end_time) { const endDate = new Date(event.end_time); const sameYear = startDate.getFullYear() === endDate.getFullYear(); const sameDay = startDate.getDate() === endDate.getDate() && startDate.getMonth() === endDate.getMonth() && sameYear; if (sameDay) { date = ( <> {' - '} ); } else { date = ( <> {' - '} ); } } else { date = ( ); } return ( {date} ); }; export default EventDate;