import { ValidatorFn } from '@angular/forms'; /** * Type for custom error messages used for custom validation. * * ### Import * * ```typescript * import { CustomErrMsg } from '@talenra/ngx-base/user-input-common'; * ``` */ interface CustomErrMsg { /** The error identifier. */ code: string; /** The error message. */ text: string; } /** * Collects custom form-validators which can be used by a reactive form. * * ```typescript * form: FormGroup = new FormGroup({ * date: new FormControl(null, [CustomValidators.validPeriodStartYear(2023)]) * }); * ``` * * ### Import * * ```typescript * import { CustomValidators } from '@talenra/ngx-base/user-input-common'; * ``` */ declare class CustomValidators { /** * Checks if a date's year is greater than or equal the threshold's year. * * @param threshold The minimum year * * @returns Returns a function which in case of an error it returns `{ invalidPeriodStartYear: true }` apart from that `null`. */ static validPeriodStartYear(threshold: number): ValidatorFn; /** * Checks if the start date is before the end date. * * @param startDateId Name of the form-control * @param endDateId Name of the form-control * @param allowSameDay Allows the end date to be on the same day as the start date, default is 'false' * * @returns Returns a function which in case of an error it returns `{ invalidDateOrder: true }` apart from that `null`. */ static startDateBeforeEndDate(startDateId: string, endDateId: string, allowSameDay?: boolean): ValidatorFn; } export { CustomValidators }; export type { CustomErrMsg };