diff --git a/client/extensions/tga-sign-off/src/components/SignOffListItem.tsx b/client/extensions/tga-sign-off/src/components/SignOffListItem.tsx
index 77d7d2b..53caf9a 100644
--- a/client/extensions/tga-sign-off/src/components/SignOffListItem.tsx
+++ b/client/extensions/tga-sign-off/src/components/SignOffListItem.tsx
@@ -23,6 +23,7 @@ interface IPropsApproved extends IPropsBase {
interface IPropsPendingOrExpired extends IPropsBase {
state: 'pending';
date: string;
+ expiryDate: string;
}
interface IPropsNotSend extends IPropsBase {
@@ -31,6 +32,13 @@ interface IPropsNotSend extends IPropsBase {
type IProps = IPropsApproved | IPropsPendingOrExpired | IPropsNotSend;
+const isExpired = (date: string) => {
+ const currentDate = new Date();
+ const expiryDate = new Date(date);
+
+ return currentDate > expiryDate;
+};
+
export function SignOffListItem(props: IProps) {
const {formatDateTime, gettext} = superdesk.localization;
@@ -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.expiryDate)
+ ? (
+ {gettext('Expired')}
+ )
+ : (
+ {gettext('Sent')}
+ )
+ }
)}
{props.state !== 'not_sent' ? null : (
diff --git a/client/extensions/tga-sign-off/src/components/fields/editor.tsx b/client/extensions/tga-sign-off/src/components/fields/editor.tsx
index bc9b0f7..b2d0e96 100644
--- a/client/extensions/tga-sign-off/src/components/fields/editor.tsx
+++ b/client/extensions/tga-sign-off/src/components/fields/editor.tsx
@@ -213,6 +213,7 @@ export class UserSignOffField extends React.Component {
onClick: this.sendSignOff.bind(this, [pendingReview.user_id]),
}]}
date={pendingReview.sent}
+ expiryDate={pendingReview.expires}
/>
)
))}
diff --git a/client/extensions/tga-sign-off/src/components/fields/preview.tsx b/client/extensions/tga-sign-off/src/components/fields/preview.tsx
index 1e3af03..ac2f0ce 100644
--- a/client/extensions/tga-sign-off/src/components/fields/preview.tsx
+++ b/client/extensions/tga-sign-off/src/components/fields/preview.tsx
@@ -120,7 +120,8 @@ export class UserSignOffPreview extends React.PureComponent {
user={this.state.users[pendingReview.user_id]}
readOnly={true}
appendContentDivider={true}
- date={pendingReview.expires}
+ date={pendingReview.sent}
+ expiryDate={pendingReview.expires}
/>
)
))}