all repos — caroster @ 3a6483727355d59a734458de22d13c6088c9ce29

[Octree] Group carpool to your event https://caroster.io

frontend/containers/DrawerNotification/formatDate.ts (view raw)

 1import moment from 'moment';
 2import { useTranslation } from 'react-i18next';
 3
 4export 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};