devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
34 lines (33 loc) • 1.18 kB
JavaScript
/**
* DevExtreme (localization/currency.js)
* Version: 18.1.3
* Build date: Tue May 15 2018
*
* Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
var extend = require("../core/utils/extend").extend,
numberLocalization = require("./number");
numberLocalization.inject({
_formatNumberCore: function(value, format, formatConfig) {
if ("currency" === format) {
formatConfig.precision = formatConfig.precision || 0;
var result = this.format(value, extend({}, formatConfig, {
type: "fixedpoint"
})),
currencyPart = this.getCurrencySymbol().symbol.replace("$", "$$$$");
result = result.replace(/^(\D*)(\d.*)/, "$1" + currencyPart + "$2");
return result
}
return this.callBase.apply(this, arguments)
},
getCurrencySymbol: function() {
return {
symbol: "$"
}
},
getOpenXmlCurrencyFormat: function() {
return "$#,##0{0}_);\\($#,##0{0}\\)"
}
});