diff --git a/js/localization/number.js b/js/localization/number.js index 6e8d721de957..dcb8fc148bc3 100644 --- a/js/localization/number.js +++ b/js/localization/number.js @@ -242,9 +242,9 @@ var numberLocalization = dependencyInjector({ return 1; } - var negativeEtalon = this.format(-1, format), - separators = this._getSeparators(), + var separators = this._getSeparators(), regExp = new RegExp("[0-9" + escapeRegExp(separators.decimalSeparator + separators.thousandsSeparator) + "]+", "g"), + negativeEtalon = this.format(-1, format).replace(regExp, "1"), cleanedText = text.replace(regExp, "1"); return cleanedText === negativeEtalon ? -1 : 1; diff --git a/testing/tests/DevExpress.localization/localization.base.tests.js b/testing/tests/DevExpress.localization/localization.base.tests.js index 4ba300077b2a..3ea7ffcf4f3d 100644 --- a/testing/tests/DevExpress.localization/localization.base.tests.js +++ b/testing/tests/DevExpress.localization/localization.base.tests.js @@ -718,6 +718,10 @@ QUnit.test("parse: test starts with not digit symbols", function(assert) { assert.equal(numberLocalization.parse("1.2 руб."), 1.2); }); +QUnit.test("parse: test different negative format", function(assert) { + assert.equal(numberLocalization.parse("<<1.0>>", "#0.00;<<#0.00>>"), -1); +}); + QUnit.test('Fixed point numeric formats', function(assert) { assert.equal(numberLocalization.format(23.04059872, { type: "fIxedPoint", precision: 4 }), '23.0406'); assert.equal(numberLocalization.format(23.04059872, "fIxedPoint"), "23"); @@ -870,7 +874,7 @@ QUnit.test("date", function(assert) { QUnit.test("'no parser' errors", function(assert) { var numberFormatter = function(value) { - return 1; + return "1"; }, dateFormatter = function(value) { return new Date(0, 0, 1);