summaryrefslogtreecommitdiff
path: root/storefront/lib/format.js
diff options
context:
space:
mode:
authorToshiro <toshiro@huitral.local>2026-02-01 03:17:06 +0100
committerToshiro <toshiro@huitral.local>2026-02-01 03:17:06 +0100
commit7579b72cba4248e1b33fae004a97c8513dfca005 (patch)
tree1f69e33aebbe880bcf52a48301a23e959ff20652 /storefront/lib/format.js
parentb7c594e72b993340bc6b70a74643506e543d3a12 (diff)
parentbc6f65dc9afa29fbb94038b1cfd5cbee2d87719c (diff)
merge:resolve conflicts
Diffstat (limited to 'storefront/lib/format.js')
-rw-r--r--storefront/lib/format.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/storefront/lib/format.js b/storefront/lib/format.js
new file mode 100644
index 0000000..9e92a8b
--- /dev/null
+++ b/storefront/lib/format.js
@@ -0,0 +1,11 @@
+export const formatAmount = (amount, currencyCode = "EUR") => {
+ if (typeof amount !== "number") {
+ return ""
+ }
+
+ const normalizedCurrency = currencyCode.toUpperCase()
+ return new Intl.NumberFormat("fr-FR", {
+ style: "currency",
+ currency: normalizedCurrency,
+ }).format(amount / 100)
+}