Charge min and max cap validatons on focus

This commit is contained in:
Jose Alberto Hernandez
2025-05-25 10:25:25 -05:00
parent f062228fc7
commit cc2b1d459f
@@ -1,16 +0,0 @@
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
export function minLessThanOrEqualMaxValidator(minKey: string, maxKey: string): ValidatorFn {
return (group: AbstractControl): ValidationErrors | null => {
const min = group.get(minKey)?.value;
const max = group.get(maxKey)?.value;
if (min != null && max != null) {
if (max * 1 < min * 1) {
return { minGreaterThanMax: true };
}
}
return null;
};
}