Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/input.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class InputService {
let {allowNegative, decimal, precision, prefix, suffix, thousands, min, max, inputMode} = this.options;

rawValue = isNumber ? new Number(rawValue).toFixed(precision) : rawValue;
let onlyNumbers = rawValue.replace(this.ONLY_NUMBERS_REGEX, "");
let onlyNumbers = rawValue.replace(suffix,"").replace(this.ONLY_NUMBERS_REGEX, "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that suffix can be anything and it cannot be simply removed from any position of rawValue. It would be better to check that the string ends with suffix and remove suffix.length characters from the end of rawValue.
I think you can similarly remove prefix.


if (!onlyNumbers && rawValue !== decimal) {
return "";
Expand Down