Fix: monetary field with null values

This commit is contained in:
shamoon
2024-04-20 21:44:31 -07:00
parent bf430865b4
commit d002ae2e05
2 changed files with 31 additions and 0 deletions

View File

@@ -56,6 +56,9 @@ export class MonetaryComponent extends AbstractInputComponent<string> {
}
private parseMonetaryValue(value: string, fixed: boolean = false): string {
if (!value) {
return ''
}
const val: number = parseFloat(value.toString().replace(/[^0-9.,-]+/g, ''))
return fixed ? val.toFixed(2) : val.toString()
}