"angular start date end date validation" Code Answer's
You're definitely familiar with the best coding language TypeScript that developers use to develop their projects and they get all their queries like "angular start date end date validation" answered properly. Developers are finding an appropriate answer about angular start date end date validation related to the TypeScript coding language. By visiting this online portal developers get answers concerning TypeScript codes question like angular start date end date validation. Enter your desired code related query in the search bar and get every piece of information about TypeScript code related question on angular start date end date validation.
angular start date end date validation
export class CustomeDateValidators {
static fromToDate(fromDateField: string, toDateField: string, errorName: string = 'fromToDate'): ValidatorFn {
return (formGroup: AbstractControl): { [key: string]: boolean } | null => {
const fromDate = formGroup.get(fromDateField).value;
const toDate = formGroup.get(toDateField).value;
// Ausing the fromDate and toDate are numbers. In not convert them first after null check
if ((fromDate !== null && toDate !== null) && fromDate > toDate) {
return {[errorName]: true};
}
return null;
};
}
}
/*--- implementations ---*/
this.form = this.fb.group({
fromDate: null,
toDate: null,
}, { validator: [
//Default error with this validator: {fromToDate: true}
CustomeDateValidators.fromToDate('fromDate', 'toDate')
// For custome error name like: {customeErrorName: true}, pass third optional parameter with custome name
// CustomeDateValidators.fromToDate('fromDate', 'toDate', 'customeErrorName')
]});
Source: stackoverflow.com
All those coders who are working on the TypeScript based application and are stuck on angular start date end date validation can get a collection of related answers to their query. Programmers need to enter their query on angular start date end date validation related to TypeScript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about angular start date end date validation for the programmers working on TypeScript code while coding their module. Coders are also allowed to rectify already present answers of angular start date end date validation while working on the TypeScript language code. Developers can add up suggestions if they deem fit any other answer relating to "angular start date end date validation". Visit this developer's friendly online web community, CodeProZone, and get your queries like angular start date end date validation resolved professionally and stay updated to the latest TypeScript updates.