Allow lowercase letters in monetary currency field

This commit is contained in:
shamoon 2024-04-10 07:26:32 -07:00
parent 95c24a50f7
commit c690dad174

View File

@ -35,12 +35,12 @@ export class MonetaryComponent extends AbstractInputComponent<string> {
get currencyCode(): string {
const focused = document.activeElement === this.currencyField?.nativeElement
if (focused && this.value) return this.value.match(/^([A-Z]{0,3})/)?.[0]
if (focused && this.value) return this.value.match(/^([a-zA-Z]{0,3})/)?.[0]
return (
this.value
?.toString()
.toUpperCase()
.match(/^([A-Z]{1,3})/)?.[0] ?? this.defaultCurrencyCode
.match(/^([a-zA-Z]{1,3})/)?.[0] ?? this.defaultCurrencyCode
)
}