(currencyCode: string)
| 1 | export const getCurrencySymbol = (currencyCode: string): string => { |
| 2 | try { |
| 3 | return new Intl.NumberFormat("en-US", { |
| 4 | style: "currency", |
| 5 | currency: currencyCode, |
| 6 | }) |
| 7 | .formatToParts(1) |
| 8 | .find((part) => part.type === "currency")!.value; |
| 9 | } catch (error) { |
| 10 | console.error(`Invalid currency code: ${currencyCode}`); |
| 11 | return ""; |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | export const getDateString = (timeStamp = Date.now()): string => { |
| 16 | const dateOptions: Intl.DateTimeFormatOptions = { |
no outgoing calls
no test coverage detected