From 5163cccca4a55e5345871716db09b610f233826b Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Mon, 9 May 2022 20:24:20 +0200 Subject: [PATCH] Replace Luxon DateTime with number in ui-notification redux state Signed-off-by: Tilman Vatteroth --- src/components/notifications/ui-notification-toast.tsx | 5 ++++- src/redux/ui-notifications/methods.ts | 2 +- src/redux/ui-notifications/types.ts | 3 +-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/notifications/ui-notification-toast.tsx b/src/components/notifications/ui-notification-toast.tsx index ec2979a6f..786eff28b 100644 --- a/src/components/notifications/ui-notification-toast.tsx +++ b/src/components/notifications/ui-notification-toast.tsx @@ -16,6 +16,7 @@ import { cypressId } from '../../utils/cypress-attribute' import { useEffectOnce, useInterval } from 'react-use' import { dismissUiNotification } from '../../redux/ui-notifications/methods' import styles from './notifications.module.scss' +import { DateTime } from 'luxon' const STEPS_PER_SECOND = 10 const log = new Logger('UiNotificationToast') @@ -89,6 +90,8 @@ export const UiNotificationToast: React.FC = ({ }) }, [contentI18nKey, contentI18nOptions, t]) + const formattedDate = useMemo(() => DateTime.fromSeconds(date).toRelative({ style: 'short' }), [date]) + return ( @@ -98,7 +101,7 @@ export const UiNotificationToast: React.FC = ({ - {date.toRelative({ style: 'short' })} + {formattedDate} {contentDom}