<ion-input> number input becomes null entering 2 "-" signs

I have a form with a number input but it breaks if the user enters 2 negative signs.

A. Entering “-20” gets saved to the form as “-20”
B. Entering 2 negative signs “–20” gets saved as null

  1. Why is the user allowed the enter 2 negative signs when the input type is number? Shouldn’t it know that is not a proper format for numbers?

  2. How can I make sure the user can’t enter two negative signs to break the input?

Form Input:

<ion-input
  formControlName="startTemperature"
  type="number"
></ion-input>

User Enters:
Screen Shot 2022-01-06 at 12.35.33 PM

Form Value becomes null:
Screen Shot 2022-01-06 at 12.35.56 PM

You should use a regex to check the values typed by users.

  1. Use Forms
  2. Use a regex that fits your need
  3. Show an error message in case of error (disabled the submit, alert message etc)

My reading of this discussion suggests that one is better off pretending type="number" doesn’t exist, as it doesn’t seem to guarantee much of anything useful consistently across all browsers.