Currency setting is now utilized in filament/spool lists, edit pages etc
This commit is contained in:
19
client/src/utils/settings.ts
Normal file
19
client/src/utils/settings.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useGetSetting } from "./querySettings";
|
||||
|
||||
export function useCurrency() {
|
||||
const { data: currency } = useGetSetting("currency");
|
||||
return JSON.parse(currency?.value ?? '"EUR"');
|
||||
}
|
||||
|
||||
export function getCurrencySymbol(locale: string | undefined, currency: string) {
|
||||
return (0)
|
||||
.toLocaleString(locale, {
|
||||
style: "currency",
|
||||
currency,
|
||||
currencyDisplay: "narrowSymbol",
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0,
|
||||
})
|
||||
.replace(/\d/g, "")
|
||||
.trim();
|
||||
}
|
||||
Reference in New Issue
Block a user