mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 21:00:39 +08:00
Fix #478 - Add replace separators to internal format function
This commit is contained in:
parent
3d9fcc190e
commit
7c96218746
2 changed files with 16 additions and 0 deletions
|
@ -64,6 +64,7 @@ export class CurrencyFormatter implements Formatter {
|
||||||
|
|
||||||
const digitsInfo = this.getDigitsInfo(digits);
|
const digitsInfo = this.getDigitsInfo(digits);
|
||||||
let formatted: string;
|
let formatted: string;
|
||||||
|
value = this.replaceSeparatorsToInternalFormat(value);
|
||||||
|
|
||||||
if (options && options.mode === 'edit') {
|
if (options && options.mode === 'edit') {
|
||||||
formatted = formatNumber(Number(value), this.locale, digitsInfo);
|
formatted = formatNumber(Number(value), this.locale, digitsInfo);
|
||||||
|
@ -142,4 +143,8 @@ export class CurrencyFormatter implements Formatter {
|
||||||
replaceSeparators(transformed: string): string {
|
replaceSeparators(transformed: string): string {
|
||||||
return this.numberFormatter.replaceSeparators(transformed);
|
return this.numberFormatter.replaceSeparators(transformed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
replaceSeparatorsToInternalFormat(value: string): string {
|
||||||
|
return this.numberFormatter.replaceSeparatorsToInternalFormat(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,17 @@ export class NumberFormatter implements Formatter {
|
||||||
return transformed;
|
return transformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
replaceSeparatorsToInternalFormat(value: string): string {
|
||||||
|
const decimalSymbol = this.getDecimalsSymbol() || '.';
|
||||||
|
|
||||||
|
const formattedValue = this.toInternalFormat(value);
|
||||||
|
|
||||||
|
if (decimalSymbol !== '.' && value.includes(decimalSymbol)) {
|
||||||
|
value = formattedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
validateIntUserFormat(inputValue: any): boolean {
|
validateIntUserFormat(inputValue: any): boolean {
|
||||||
|
|
||||||
const trimmedInputValue = this.formUtils.getTrimmedInputValue(inputValue);
|
const trimmedInputValue = this.formUtils.getTrimmedInputValue(inputValue);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue