Skip to content

Commit 69e2c81

Browse files
authored
[candidate_parameters] Add date restriction for consent withdrawal (#8298)
Add validation of dates in consent tab. fixes #6993 fixes #6102
1 parent 0b84110 commit 69e2c81

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

modules/candidate_parameters/jsx/ConsentStatus.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,22 +158,29 @@ class ConsentStatus extends Component {
158158
let consentWithdrawal = consentStatus + '_withdrawal';
159159
let consentWithdrawal2 = consentStatus + '_withdrawal2';
160160

161-
date1 = myFormData[consentWithdrawal] ?
161+
const withdrawDate1 = myFormData[consentWithdrawal] ?
162162
myFormData[consentWithdrawal] : null;
163-
date2 = myFormData[consentWithdrawal2] ?
163+
const withdrawDate2 = myFormData[consentWithdrawal2] ?
164164
myFormData[consentWithdrawal2] : null;
165165

166-
if (date1 !== date2) {
166+
if (withdrawDate1 !== withdrawDate2) {
167167
alert(label + ' withdrawal dates do not match!');
168168
return;
169169
}
170-
if (date1 > today) {
170+
if (withdrawDate1 > today) {
171171
alert(
172172
label
173173
+ ' withdrawal date cannot be later than today!'
174174
);
175175
return;
176176
}
177+
if (withdrawDate1 < date1) {
178+
alert(
179+
label
180+
+ ' withdrawal date cannot be earlier than response date!'
181+
);
182+
return;
183+
}
177184
}
178185
}
179186
// Set form data

0 commit comments

Comments
 (0)