import { ValidatorFn, FormControl, AbstractControl } from '@angular/forms'; import moment from 'moment'; import { IValidateDateTime } from '../models/interfaces'; import { CoreSessionService } from '../providers/services/session.service'; import { NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'; export declare class CustomValidator { private coreSessionService; constructor(coreSessionService: CoreSessionService); /** * FormGroup level validator */ maxCurrentDate(eventSourceFieldName: string): ValidatorFn; /** * FormGroup level validator */ minCurrentDate(eventSourceFieldName: string): ValidatorFn; /** * FormGroup level validator */ dateTimeValidator(field: object, supportingParams: IValidateDateTime): ValidatorFn; /** * Returns latest among all passed dates for min date validations */ latestAmong(formGroup: any, fieldSchema: object): ValidatorFn; /** * Returns latest among all passed dates for max date validations */ latestAmongMax(formGroup: any, fieldSchema: object): ValidatorFn; /** * Returns latest among all passed dates for max date validations */ maxDateFromSession(formGroup: any, fieldSchema: object): ValidatorFn; /** * remove error from form control */ removeError(control: FormControl | AbstractControl, errorName: string): boolean; /** * get value of date field */ private getValue; /** * This method will calculate date and returns the final date for comparison */ constructDate(param: any, form: any): moment.MomentObjectOutput; /** * This method subtract 1 month from the moment date as moment index starts from '0' and ends with '11' for input scenario */ convertDateToInputMoment(value: any): { year: number; month: number; day: number; }; /** * Formats the given NgbDateStruct to a string * @param date - date */ format(date: NgbDateStruct): string; /** * check if value is number or not */ isNumber(value: any): value is number; /** * converts value to integer */ toInteger(value: any): number; /** * change the value to required structure */ padNumber(value: number): string; /** * extract value from form * @param param - param * @param form - form */ private extractValueFromForm; /** * get current date */ private getCurrentDate; /** * get latest date among all */ private getLatestDate; /** * FormGroup level validator */ maxDate(eventSourceFieldName: string, fieldValidation: any): ValidatorFn; /** * FormGroup level validator */ minDate(eventSourceFieldName: string, fieldValidation: any): ValidatorFn; /** * FormGroup level validator * This function will be called for control(source) whose date * value has to be compared with other control(target) */ lessThanTargetDate(formGroup: any, fieldValidation: any): ValidatorFn; /** * This function will be called for control(source) whose * date value has to be compared with other control(target) */ greaterThanTargetDate(formGroup: any, targetFieldName: string): ValidatorFn; }