diff --git a/client/extensions/tga-sign-off/src/components/SignOffListItem.tsx b/client/extensions/tga-sign-off/src/components/SignOffListItem.tsx index 77d7d2b..5e04b74 100644 --- a/client/extensions/tga-sign-off/src/components/SignOffListItem.tsx +++ b/client/extensions/tga-sign-off/src/components/SignOffListItem.tsx @@ -34,6 +34,14 @@ type IProps = IPropsApproved | IPropsPendingOrExpired | IPropsNotSend; export function SignOffListItem(props: IProps) { const {formatDateTime, gettext} = superdesk.localization; + const isExpired = (date: string) => { + const sentDate = new Date(date); + const currentDate = new Date(); + const expiryDate = new Date(sentDate.getTime() + 24 * 60 * 60 * 1000); + + return currentDate > expiryDate; + }; + return (
@@ -89,11 +97,14 @@ export function SignOffListItem(props: IProps) { {props.state !== 'pending' ? null : (
- {new Date(props.date) <= new Date() ? ( - {gettext('Expired')} - ): ( - {gettext('Pending')} - )} + {isExpired(props.date) + ? ( + {gettext('Expired')} + ) + : ( + {gettext('Sent')} + ) + }
)} {props.state !== 'not_sent' ? null : (