MediaWiki:DonationFormSandbox.js: Difference between revisions
Content deleted Content added
use donationForm.formatCurrency for pay the fee |
try and use currencyDisplay: 'narrowSymbol' if browser supports it |
||
Line 246:
};
/* Amount and currency formatting */
let formatters = {
//
donationForm.locale, { style: 'currency', currency: donationForm.currency }▼
),
{}
donationForm.locale, { style: 'currency', currency: donationForm.currency, minimumFractionDigits: 0 }▼
),▼
▲ donationForm.locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 }
),▼
)
}
// currencyDisplay: 'narrowSymbol' fixes some issues like en-CO showing the ISO code
// but browser support is lacking, so wrap in a try/catch
try {
formatters.currencyFraction = new Intl.NumberFormat( donationForm.locale,
{ style: 'currency', currency: donationForm.currency, currencyDisplay: 'narrowSymbol' }
formatters.currencyWhole = new Intl.NumberFormat( donationForm.locale,
{ style: 'currency', currency: donationForm.currency, currencyDisplay: 'narrowSymbol', minimumFractionDigits: 0 }
} catch(e) {
formatters.currencyFraction = new Intl.NumberFormat( donationForm.locale,
);
formatters.currencyWhole = new Intl.NumberFormat( donationForm.locale,
▲
);
}
donationForm.formatCurrency = function( amount ) {
|