Skip to content

Commit

Permalink
PER-9237
Browse files Browse the repository at this point in the history
Fixed the integer validator so numbers such as 2.0 do not pass the check
  • Loading branch information
crisnicandrei committed Jul 25, 2023
1 parent a7a4e2a commit 556df8e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export class GiftStorageComponent implements OnDestroy {

integerValidator(control: FormControl) {
const isInteger = Number.isInteger(Number(control.value));
return isInteger ? null : { notInteger: true };
const hasDecimalPoint = control.value.toString().includes('.');

return isInteger && !hasDecimalPoint ? null : { notInteger: true };
}
}

0 comments on commit 556df8e

Please sign in to comment.