18 lines
418 B
TypeScript
18 lines
418 B
TypeScript
export function formatCurrencyChfCentimes(amount: number | undefined) {
|
|
if (!amount) {
|
|
return formatCurrencyChf(undefined);
|
|
}
|
|
return formatCurrencyChf(amount / 100);
|
|
}
|
|
|
|
// 10378.2 => 10'378
|
|
export function formatCurrencyChf(amount: number | undefined) {
|
|
if (!amount) {
|
|
return "?";
|
|
}
|
|
return new Intl.NumberFormat("de-CH", {
|
|
style: "decimal",
|
|
maximumFractionDigits: 0,
|
|
}).format(amount);
|
|
}
|