Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit c6662dd

Browse files
authored
Merge pull request #337 from ghiscoding/bugfix/firefox-throw-regex-error
fix(firefox): thousand separator regex lookbehind not allow, fixes #336
2 parents 3f0cef6 + 4c3ed76 commit c6662dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/app/modules/angular-slickgrid/services/utilities.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,11 @@ export function setDeepValue(obj: any, path: string | string[], value: any) {
614614
export function thousandSeparatorFormatted(inputValue: string | number | null, separator: ',' | '_' | '.' | ' ' | '' = ','): string | null {
615615
if (inputValue !== null && inputValue !== undefined) {
616616
const stringValue = `${inputValue}`;
617-
return stringValue.replace(/(?<!\.\d+)\B(?=(\d{3})+\b)/g, separator);
617+
const decimalSplit = stringValue.split('.');
618+
if (decimalSplit.length === 2) {
619+
return `${decimalSplit[0].replace(/\B(?=(\d{3})+(?!\d))/g, separator)}.${decimalSplit[1]}`;
620+
}
621+
return stringValue.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
618622
}
619623
return inputValue as null;
620624
}

0 commit comments

Comments
 (0)