Skip to content

Commit

Permalink
fix(cb2-10321): ensure validation is run only when control is visible (
Browse files Browse the repository at this point in the history
  • Loading branch information
pbardy2000 committed Jan 3, 2024
1 parent 83faa81 commit f26be6f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion src/app/forms/templates/general/adr.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,6 @@ export const AdrTemplate: FormNode = {
name: ValidatorNames.RequiredIfNotHidden,
},
],

},
{
name: 'techRecord_adrDetails_declarationsSeen',
Expand Down
1 change: 1 addition & 0 deletions src/app/forms/validators/custom-validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export class CustomValidators {
};

static dateIsInvalid: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {
if (control instanceof CustomFormControl && control.meta.hide) return null;
const [yyyy, mm, dd] = (control.value ?? '').split('-');
const label = control instanceof CustomFormControl ? control.meta.label : undefined;
const checks = validateDate(parseInt(dd ?? '', 10), parseInt(mm ?? '', 10), parseInt(yyyy ?? '', 10), label);
Expand Down

0 comments on commit f26be6f

Please sign in to comment.