all repos — caroster @ a7f00a96575b17ed51637a09a10f0361ce410007

[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};