@elemental/ui / Class

LmnValidators

No documentation has been provided.

Static Methods

static

date()

No documentation has been provided.

Presentation
static date(format: string, required: boolean = true, strict: boolean = false): ValidatorFn;
Parameters
NameTypeDescription
format
string
required
boolean
strict
boolean
Returns
static

dateOrderValidator()

Check if the second date is after the first date. When this check fails the dateOrder error is set to the FormGroup and to the second date FormControl

Example of use:

this.formGroup = new UntypedFormGroup({
  startDate: new UntypedFormControl(
    { value: new LmnDate('2022-08-20'), disabled: false },
    [Validators.required, LmnValidators.lmnDate],
  ),
  endDate: new UntypedFormControl(
    { value: new LmnDate('2022-08-22'), disabled: false },
    [Validators.required, LmnValidators.lmnDate],
  ),
});

this.formGroup.setValidators(
  LmnValidators.dateOrderValidator('startDate', 'endDate'),
);
Presentation
static dateOrderValidator(firstDateFormControlName: string, secondDateFormControlName: string): ValidatorFn;
Parameters
NameTypeDescription
firstDateFormControlName
string

@param firstDateFormControlName

secondDateFormControlName
string

@param secondDateFormControlName

Returns
static

lmnDate()

No documentation has been provided.

Presentation
static lmnDate(control: AbstractControl<any, any>): { lmnDate: boolean; } | null;
Parameters
NameTypeDescription
control
AbstractControl<any, any>
Returns
{ lmnDate: boolean; } | null
static

requiredAtLeastTrue()

A validator that can be used with a formGroup or formControl to check if at least a number of object properties are true.

Presentation
static requiredAtLeastTrue(numberOfTrue: number): ValidatorFn;
Parameters
NameTypeDescription
numberOfTrue
number

@param numberOfTrue number of true values required

Returns