swiftlocal / src /lib /utils.ts
Joedroid's picture
feat: live currency conversion via exchange rate API with caching
0bca8fa
Raw
History Blame Contribute Delete
280 Bytes
/**
* Format price in GHS (native currency — all prices stored in GHS)
*/
export function formatPrice(ghsPrice: number, discount?: number): string {
const effective = discount !== undefined ? ghsPrice * (1 - discount) : ghsPrice;
return `GH₵ ${effective.toFixed(2)}`;
}