Skip to content

Commit 90eff80

Browse files
NLB-7074: Handle currency format decimal precision
1 parent d5304e4 commit 90eff80

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

content/nginxaas-azure/app-protect/enable-waf.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ type:
1212
This guide explains how to enable F5 WAF for NGINX on a F5 NGINX as a Service for Azure (NGINXaaS) deployment. [F5 WAF for NGINX](https://docs.nginx.com/nginx-app-protect-waf/v5) provides web application firewall (WAF) security protection for your web applications, including OWASP Top 10; response inspection; Meta characters check; HTTP protocol compliance; evasion techniques; disallowed file types; JSON & XML well-formedness; sensitive parameters & Data Guard.
1313

1414
## Before you start
15-
- F5 WAF for NGINX can only be enabled on NGINXaaS for Azure deployments with the **Standard v3** [plan]({{< ref "/nginxaas-azure/billing/overview.md" >}})
15+
16+
- F5 WAF for NGINX can only be enabled on NGINXaaS for Azure deployments with the **Standard v2** and **Standard v3** [plan]({{< ref "/nginxaas-azure/billing/overview.md" >}})
1617

1718
## Enable F5 WAF for NGINX
1819

static/nginxaas-azure/js/cost-calculator_v2.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,18 @@
135135
* @param {number} significantDigits
136136
* @returns {string}
137137
*/
138-
currencyFormatter: (n, significantDigits = 5) => {
138+
currencyFormatter: (n, significantDigits) => {
139+
const isWhole = Number.isInteger(n);
139140
const options = {
140141
style: "currency",
141142
currency: "USD"
142143
};
143-
144-
// Only add maximumSignificantDigits if significantDigits is provided and valid
145-
if (significantDigits && significantDigits > 0) {
144+
if (significantDigits !== undefined) {
146145
options.maximumSignificantDigits = significantDigits;
146+
} else {
147+
options.minimumFractionDigits = isWhole ? 0 : 2;
148+
options.maximumFractionDigits = isWhole ? 0 : 2;
147149
}
148-
149150
return new Intl.NumberFormat("en-US", options).format(n);
150151
},
151152
};
@@ -334,10 +335,10 @@
334335

335336
const tier = regionsTiers[tierKey].tier;
336337

337-
const formattedWithoutWAF = utils.currencyFormatter(tiersCosts[tier].withoutWAF);
338-
const formattedWithWAF = utils.currencyFormatter(tiersCosts[tier].withWAF);
339-
const formattedDeploymentWithoutWAF = utils.currencyFormatter(costs.deploymentFee[tier].withoutWAF);
340-
const formattedDeploymentWithWAF = utils.currencyFormatter(costs.deploymentFee[tier].withWAF);
338+
const formattedWithoutWAF = utils.currencyFormatter(tiersCosts[tier].withoutWAF, 5);
339+
const formattedWithWAF = utils.currencyFormatter(tiersCosts[tier].withWAF, 5);
340+
const formattedDeploymentWithoutWAF = utils.currencyFormatter(costs.deploymentFee[tier].withoutWAF, 5);
341+
const formattedDeploymentWithWAF = utils.currencyFormatter(costs.deploymentFee[tier].withWAF, 5);
341342

342343
col1.innerText = `${regionsTiers[tierKey].label}`;
343344
col2.innerText = `${tier}`;

0 commit comments

Comments
 (0)