Add backend routes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,23 +1 @@
|
|||||||
/**
|
|
||||||
* Format a number as currency with the specified locale and currency code
|
|
||||||
* @param value - The number to format
|
|
||||||
* @param locale - The locale to use for formatting (defaults to 'en-US')
|
|
||||||
* @param currency - The currency code to use (defaults to 'USD')
|
|
||||||
* @returns Formatted currency string
|
|
||||||
*/
|
|
||||||
export function formatCurrency(
|
|
||||||
value: number | null | undefined,
|
|
||||||
locale: string = 'en-US',
|
|
||||||
currency: string = 'USD'
|
|
||||||
): string {
|
|
||||||
if (value === null || value === undefined) {
|
|
||||||
return '$0.00';
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Intl.NumberFormat(locale, {
|
|
||||||
style: 'currency',
|
|
||||||
currency: currency,
|
|
||||||
minimumFractionDigits: 2,
|
|
||||||
maximumFractionDigits: 2,
|
|
||||||
}).format(value);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user