Skip to content

Commit

Permalink
treat numbers padded with 0 as a string
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg committed Feb 19, 2025
1 parent 887a114 commit 6ddd462
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/common/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ const Utils = Object.assign({}, require('./base/_utils'), {
}

const typedValue = testWithTrim ? str.trim() : str
const isNum = /^-?\d+$/.test(typedValue)
// Check if the value is sensible number, returns false if it has leading 0s
const isNum = /^-?(0|[1-9]\d*)$/.test(typedValue)

if (isNum && parseInt(typedValue) > Number.MAX_SAFE_INTEGER) {
return `${str}`
Expand Down

0 comments on commit 6ddd462

Please sign in to comment.