diff --git a/src/webex/renderHtml.tsx b/src/webex/renderHtml.tsx index 2e21932b0..e4686adee 100644 --- a/src/webex/renderHtml.tsx +++ b/src/webex/renderHtml.tsx @@ -48,12 +48,21 @@ import * as React from "react"; * Render amount as HTML, which non-breaking space between * decimal value and currency. */ -export function renderAmount(amount: AmountJson) { - const x = amount.value + amount.fraction / Amounts.fractionalBase; - return {x} {amount.currency}; +export function renderAmount(amount: AmountJson | string) { + let a; + if (typeof amount === "string") { + a = Amounts.parse(amount); + } else { + a = amount; + } + if (!a) { + return (invalid amount); + } + const x = a.value + a.fraction / Amounts.fractionalBase; + return {x} {a.currency}; } -export const AmountDisplay = ({amount}: {amount: AmountJson}) => renderAmount(amount); +export const AmountDisplay = ({amount}: {amount: AmountJson | string}) => renderAmount(amount); /**