formatDate.ts
 1  import moment from 'moment';
 2  import { useTranslation } from 'react-i18next';
 3  
 4  export const formatDate = (dateString: string) => {
 5      const momentDate = moment(dateString);
 6      const isToday = momentDate.isSame(moment(), 'day');
 7      const { t } = useTranslation();
 8  
 9      if (isToday) {
10          return `${t('date.today')}, ${momentDate.format('hh:mm')}`;
11      } else {
12          return momentDate.format('DD/MM/YY, H:mm');
13      }
14  };