Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ mongo-data**

# ignore the task file as it will be different for different project implementations.
TASKS.md
mongodb*
20 changes: 19 additions & 1 deletion app/client/src/widgets/CurrencyInputWidget/widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,25 @@ class CurrencyInputWidget extends BaseInputWidget<
};

isTextFormatted = () => {
return this.props.text.includes(getLocaleThousandSeparator());
const text = this.props.text;
const thousandSep = getLocaleThousandSeparator();

// Check if text contains thousand separator
if (!text.includes(thousandSep)) {
return false;
}

// If text looks like an unformatted number (e.g., "12.33" where . is meant as decimal,
// not thousand separator), it's not actually formatted yet.
// Unformatted numbers from defaultText will only contain digits, optional minus, and at most one dot.
const unformattedNumberPattern = /^-?\d+\.?\d*$/;

if (unformattedNumberPattern.test(text)) {
return false;
}

// Otherwise, assume it's formatted (contains thousand separators in proper context)
return true;
};

handleFocusChange = (isFocused?: boolean) => {
Expand Down
Loading