Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Sep 15, 2024
1 parent d0bffc5 commit e72fc70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface IPropsApproved extends IPropsBase {
interface IPropsPendingOrExpired extends IPropsBase {
state: 'pending';
date: string;
expiryDate: string;
}

interface IPropsNotSend extends IPropsBase {
Expand All @@ -32,9 +33,8 @@ interface IPropsNotSend extends IPropsBase {
type IProps = IPropsApproved | IPropsPendingOrExpired | IPropsNotSend;

const isExpired = (date: string) => {
const sentDate = new Date(date);
const currentDate = new Date();
const expiryDate = new Date(sentDate.getTime() + 24 * 60 * 60 * 1000);
const expiryDate = new Date(date);

return currentDate > expiryDate;
};
Expand Down Expand Up @@ -97,7 +97,7 @@ export function SignOffListItem(props: IProps) {
{props.state !== 'pending' ? null : (
<div className="sd-margin-l--5 sd-padding-l--0-5 sd-margin-t--1">
<label className="form-label form-label--block">{gettext('State:')}</label>
{isExpired(props.date)
{isExpired(props.expiryDate)
? (
<span>{gettext('Expired')}</span>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export class UserSignOffField extends React.Component<IEditorProps, IState> {
onClick: this.sendSignOff.bind(this, [pendingReview.user_id]),
}]}
date={pendingReview.sent}
expiryDate={pendingReview.expires}
/>
)
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ export class UserSignOffPreview extends React.PureComponent<IProps, IState> {
user={this.state.users[pendingReview.user_id]}
readOnly={true}
appendContentDivider={true}
date={pendingReview.expires}
date={pendingReview.sent}
expiryDate={pendingReview.expires}
/>
)
))}
Expand Down

0 comments on commit e72fc70

Please sign in to comment.