@proangular/pro-form
Version:
A predefined set of reactive and reusable form input components based on Angular Material.
38 lines (37 loc) • 1.44 kB
TypeScript
import { DateTime } from 'luxon';
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
export declare class CustomValidators {
/**
* Validates that a given DateTime value does not exceed a maximum allowed DateTime.
*
* @param max The maximum allowed DateTime.
* @returns A validator function that checks if the value exceeds the max DateTime.
*/
static maxDateTime(max: DateTime): ValidatorFn;
/**
* Validates that a given DateTime value is not earlier than a minimum allowed DateTime.
*
* @param min The minimum allowed DateTime.
* @returns A validator function that checks if the value is below the min DateTime.
*/
static minDateTime(min: DateTime): ValidatorFn;
/**
* Validates that a given value is **not** a string.
*
* @param control The form control being validated.
* @returns A validation error if the value is a string, otherwise null.
*/
static nonString(control: AbstractControl): ValidationErrors | null;
/**
* Validates that a given value is a number.
*
* @returns A validator function that checks if the value is a number.
*/
static isNumber(): ValidatorFn;
/**
* Validates that a given value is a whole number (integer).
*
* @returns A validator function that checks if the value is a whole number.
*/
static wholeNumber(): ValidatorFn;
}