Ion input max value

I just wanna ask if there is a possible way to set the maximum input value of a number in
Like, i have a input type that required number of hours and i want to limit the input type in only 24 because there is only 24 hours. It will be a great help thanks.

One solution is to set value accordingly if higher than 24 or less than 0 like this:



<ion-input type=“number” [(ngModel)]=“time” required=“true” clearInput=true (ionChange)=“setTime(time)”></ion-input>


this.time = parseInt(time);
if(this.time > 24){
this.time = 24;
}else if(this.time < 1){
this.time = 1;

You have to parse it to Int because input returns string. And if user inputs number bigger than 24 it will automatically set it to 24, and if user inputs less than 0 it will automatically set it to 1.