Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[staging] Refactored: RemainingDaysText #532

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,18 @@ export class ProfileCardComponent implements OnInit, OnChanges {
const { diffInDays, isSameDay } = this.getDifferenceInDays(this.profile?.responseDeadline || '');
const lang = this.currentLanguage || 'en';

if (diffInDays < 0) {
const roundedDiffInDays = Math.floor(diffInDays);

if (roundedDiffInDays < 0) {
return 'Closed';
} else if (diffInDays === 0 && isSameDay) {
} else if (roundedDiffInDays === 0 || isSameDay) {
return 'Last day to respond';
} else if (diffInDays === 1) {
} else if (roundedDiffInDays === 1) {
return 'Day Remaining';
} else {
} else if(roundedDiffInDays > 1) {
return 'Days Remaining';
} else {
return ''
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ export class ConsultationCardComponent implements OnInit {
}

const { diffInDays, isSameDay } = this.getDifferenceInDays(this.consultation?.responseDeadline);
const roundedDiffInDays = Math.floor(diffInDays);

if (diffInDays < 0) {
if (roundedDiffInDays < 0) {
return 'Closed';
} else if (diffInDays === 0 && isSameDay) {
} else if (roundedDiffInDays === 0 || isSameDay) {
return 'Last day to respond';
} else if (diffInDays === 1) {
} else if (roundedDiffInDays === 1) {
return 'Day Remaining';
} else if (diffInDays > 1) {
return `Days Remaining`;
} else if(roundedDiffInDays > 1) {
return 'Days Remaining';
} else {
return ''
}

return '';
}

getDifferenceInDays(deadline) {
Expand Down