ERROR RangeError: Maximum call stack size exceeded


#1

I got this error only using ion-datetime as a input. Below is my HTML code.

<form class="form list" [formGroup]="hire" (ngSubmit)="getHire()">
    <ion-row>
	<ion-col class="inputNames" col-auto>
		<ion-label class="input-label" fixed> Name </ion-label>
	</ion-col>
        <ion-col>
		<ion-input type="text" formControlName="pasngr_name" id="inputPname" class="inputFeilds" [placeholder]="namePlaceholder"
					 (change)='checkValidation()'></ion-input>
	</ion-col>
    </ion-row>
    <ion-row>
	<ion-col class="inputNames" col-auto>
		<ion-label class="input-label" fixed> Date </ion-label>
	</ion-col>
	<ion-col center>
		<ion-datetime [min]="minDate" [max]="maxDate" pickerFormat="YYYY/MM/DD" id="inputPdate" displayFormat="YYYY/MM/DD" formControlName="pickup_date"
					 class="inputDateTime" [placeholder]="dateplaceholder" (ngModelChange)='checkValidation()'> </ion-datetime>
	</ion-col>
    </ion-row>
</form>

Below is my TS file

this.hire = new FormGroup({
      pasngr_name: new FormControl('', Validators.compose([Validators.pattern('[a-zA-Z ]*'), Validators.required])),
      pickup_date: new FormControl('', Validators.compose([Validators.required]))
});
checkValidation() {
   if (this.hire["controls"]["pasngr_name"].hasError('required')) {
      console.log(this.hire["controls"]["pasngr_name"].hasError('required'));
      this.valueName = document.getElementById("inputPname");
      this.hire["controls"]["pasngr_name"].reset();
   }
   else if (this.hire["controls"]["pickup_date"].hasError('required')) {
      console.log(this.hire["controls"]["pickup_date"].hasError('required'));
      this.valueDate = document.getElementById("inputPdate");
      this.hire["controls"]["pickup_date"].reset();
   }
}

There are more input fields are there. All of them are ion-input. If there is an error in reqiored field it prints “true” once. but there is an error in required in ion-datetime field, it prints “true” more than 700 times. Then it gives the “ERROR RangeError: Maximum call stack size exceeded”.

I tried adding
"ionic:build": "node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build" to package.json
and
--max_old_space_size=4096 --stack-size=1968 to node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js

But both of them didn’t worked. Help me