diff --git a/build.properties b/build.properties index 9940daf14b..042d7c03e7 100644 --- a/build.properties +++ b/build.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -version=14.15.0 +version=14.15.1 diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index b2f3e47955..f83a88644f 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -1,6 +1,13 @@ Release Notes for Version 14 ============================ +Build 024 +------- +Published as version 14.15.1 +New Features: + +Bug Fixes: +* Fixed isomorphic test failures by adding a value check Build 023 ------- diff --git a/js/lib/IString.js b/js/lib/IString.js index 467ab2e5f5..8371fb39e5 100644 --- a/js/lib/IString.js +++ b/js/lib/IString.js @@ -694,6 +694,7 @@ IString.prototype = { if (typeof(Intl) !== 'undefined') { if (ilib._getPlatform() === 'nodejs') { var version = process.versions["node"]; + if (!version) return false; var majorVersion = version.split(".")[0]; if (Number(majorVersion) >= 10 && (Intl.PluralRules.supportedLocalesOf(locale.getSpec()).length > 0)) { return true; diff --git a/js/test/date/testdatefmt.js b/js/test/date/testdatefmt.js index 0a40ff84c6..9e14673519 100644 --- a/js/test/date/testdatefmt.js +++ b/js/test/date/testdatefmt.js @@ -3998,10 +3998,14 @@ module.exports.testdatefmt = { var result = DateFmt.isIntlDateTimeAvailable("ko-KR"); if(ilib._getPlatform() === "nodejs") { - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; - if (majorVersion == "8" || majorVersion == "10" || majorVersion == "12") { - test.equal(result, false); + var cldrVersion = Number(process.versions["cldr"]); + var nodeMajorVersion = process.versions["node"].split(".")[0]; + if (cldrVersion < 38) { + if (nodeMajorVersion === "14") { + test.equal(result, true); + } else { + test.equal(result, false); + } } else { test.equal(result, true); } diff --git a/js/test/date/testdatefmt_en_GB.js b/js/test/date/testdatefmt_en_GB.js index c5c433b00c..3dc23d10ef 100644 --- a/js/test/date/testdatefmt_en_GB.js +++ b/js/test/date/testdatefmt_en_GB.js @@ -145,12 +145,20 @@ module.exports.testdatefmt_en_GB = { }); if(ilib._getPlatform() === "nodejs"){ - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; - if (majorVersion == "8" || majorVersion == "10") { + var cldrVersion = Number(process.versions["cldr"]); + var nodeMajorVersion = process.versions["node"].split(".")[0]; + if (cldrVersion < 36) { test.equal(fmt.format(date), "9/29/2011"); - } else if (majorVersion == "12") { - test.equal(fmt.format(date), "9/29/11"); + } else if (cldrVersion < 38) { + /* + * Both node v12.16.1 and v14.16.1 say the cldr version is 37.0. + * But it returns a different result. + */ + if (nodeMajorVersion === "14") { + test.equal(fmt.format(date), "29/09/2011"); + } else { + test.equal(fmt.format(date), "9/29/11"); + } } else { test.equal(fmt.format(date), "29/09/2011"); } @@ -181,20 +189,23 @@ module.exports.testdatefmt_en_GB = { }); if(ilib._getPlatform() === "nodejs"){ - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; + var cldrVersion = Number(process.versions["cldr"]); + var nodeMajorVersion = process.versions["node"].split(".")[0]; //console.log("version: " + version + " majorVersion: " + majorVersion); - if (majorVersion == "8" || majorVersion == "10") { + if (cldrVersion < 36) { test.equal(fmt.format(date), "9/29/2011"); - } else if (majorVersion == "12") { - test.equal(fmt.format(date), "Sep 29, 2011"); - } else if (version == "14.18.2"){ + } else if(cldrVersion < 38) { + if (nodeMajorVersion === "14") { + test.equal(fmt.format(date), "29 Sep 2011"); + } else { + test.equal(fmt.format(date), "Sep 29, 2011"); + } + } else if(cldrVersion < 39){ test.equal(fmt.format(date), "29 Sept 2011"); - } - else if (majorVersion == "16"){ + } else if(cldrVersion < 41){ test.equal(fmt.format(date), "29 Sept 2011"); } else { - test.equal(fmt.format(date), "29 Sep 2011"); + test.equal(fmt.format(date), "29 Sep 2011"); } } else { test.equal(fmt.format(date), "29 Sept 2011"); @@ -222,12 +233,17 @@ module.exports.testdatefmt_en_GB = { }); if(ilib._getPlatform() === "nodejs"){ - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; - if (majorVersion == "8" || majorVersion == "10") { + var cldrVersion = Number(process.versions["cldr"]); + var nodeMajorVersion = process.versions["node"].split(".")[0]; + if (cldrVersion < 36) { test.equal(fmt.format(date), "9/29/2011"); - } else if (majorVersion == "12") { - test.equal(fmt.format(date), "September 29, 2011"); + } else if (cldrVersion < 38) { + if (nodeMajorVersion === "14") { + test.equal(fmt.format(date), "29 September 2011"); + } else { + test.equal(fmt.format(date), "September 29, 2011"); + } + } else { test.equal(fmt.format(date), "29 September 2011"); } @@ -283,12 +299,16 @@ module.exports.testdatefmt_en_GB = { if(ilib._getPlatform() === "nodejs"){ - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; - if (majorVersion == "8" || majorVersion == "10") { + var cldrVersion = Number(process.versions["cldr"]); + var nodeMajorVersion = process.versions["node"].split(".")[0]; + if (cldrVersion < 36) { test.equal(fmt.format(date), "9/29/2011"); - } else if (majorVersion == "12") { - test.equal(fmt.format(date), "Thursday, September 29, 2011"); + } else if (cldrVersion < 38) { + if (nodeMajorVersion === "14") { + test.equal(fmt.format(date), "Thursday, 29 September 2011"); + } else { + test.equal(fmt.format(date), "Thursday, September 29, 2011"); + } } else { test.equal(fmt.format(date), "Thursday, 29 September 2011"); } @@ -1294,12 +1314,16 @@ module.exports.testdatefmt_en_GB = { }); if(ilib._getPlatform() === "nodejs") { - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; - if (majorVersion == "8" || majorVersion == "10") { + var cldrVersion = Number(process.versions["cldr"]); + var nodeMajorVersion = process.versions["node"].split(".")[0]; + if (cldrVersion < 36) { test.equal(fmt.format(date), "9/29/2011"); - } else if (majorVersion == "12") { - test.equal(fmt.format(date), "1:45 PM"); + } else if (cldrVersion < 38) { + if (nodeMajorVersion === "14") { + test.equal(fmt.format(date), "13:45"); + } else { + test.equal(fmt.format(date), "1:45 PM"); + } } else { test.equal(fmt.format(date), "13:45"); } @@ -1329,19 +1353,22 @@ module.exports.testdatefmt_en_GB = { }); if(ilib._getPlatform() === "nodejs"){ - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; - if (majorVersion == "8" || majorVersion == "10") { + var cldrVersion = Number(process.versions["cldr"]); + var nodeMajorVersion = process.versions["node"].split(".")[0]; + if (cldrVersion < 36) { test.equal(fmt.format(date), "9/29/2011"); - } else if (majorVersion == "12") { - test.equal(fmt.format(date), "1:45:10 PM"); + } else if (cldrVersion < 38) { + if (nodeMajorVersion === "14") { + test.equal(fmt.format(date), "13:45:10"); + } else { + test.equal(fmt.format(date), "1:45:10 PM"); + } } else { test.equal(fmt.format(date), "13:45:10"); } } else { test.equal(fmt.format(date), "13:45:10"); } - test.done(); }, diff --git a/js/test/date/testdatefmtasync.js b/js/test/date/testdatefmtasync.js index 32a580e1b7..84252161e6 100644 --- a/js/test/date/testdatefmtasync.js +++ b/js/test/date/testdatefmtasync.js @@ -322,9 +322,8 @@ module.exports.testdatefmtasync = { var date = new Date(2022, 4, 29); if(ilib._getPlatform() === "nodejs"){ - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; - if (majorVersion == 8 || majorVersion == 10){ + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36){ test.equal(fmt.format(date), "5/29/2022"); } else { test.equal(fmt.format(date), "May 29, 2022"); @@ -420,15 +419,12 @@ module.exports.testdatefmtasync = { sync: false, onLoad: function(fmt){ if(ilib._getPlatform() === "nodejs"){ - var version = process.versions["node"]; - var majorVersion = version.split(".")[0]; - //console.log("version: " + version); - if(majorVersion == "8" || majorVersion == "10"){ + var cldrVersion = Number(process.versions["cldr"]); + if(cldrVersion < 36){ test.equal(fmt.format(date), "9/29/2022"); } else { test.equal(fmt.format(date), "September 29, 2022"); } - } else { test.equal(fmt.format(date), "September 29, 2022"); } diff --git a/js/test/root/teststrings.js b/js/test/root/teststrings.js index de5f2383df..8c56b58c94 100644 --- a/js/test/root/teststrings.js +++ b/js/test/root/teststrings.js @@ -698,8 +698,8 @@ module.exports.teststrings = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { test.equal(str.formatChoice([params.num,params.pages], params), "0 items on 0 pages."); } else { test.equal(str.formatChoice([params.num,params.pages], params), "0 items (many) on 0 pages (many)."); @@ -3023,8 +3023,8 @@ module.exports.teststrings = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(0), "There are no items."); } else { test.equal(str.formatChoice(0), "Default items"); @@ -3249,8 +3249,8 @@ module.exports.teststrings = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(0), "There are no items."); } else { test.equal(str.formatChoice(0), "The item is one"); @@ -3280,10 +3280,10 @@ module.exports.teststrings = { test.ok(str !== null); if (ilib._getPlatform() === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(1000000), "The items are many"); - } else if (Number(cldrVersion) >= 36 && Number(cldrVersion) < 40 ) { + } else if (cldrVersion >= 36 && cldrVersion < 40 ) { test.equal(str.formatChoice(1000000), "Default items"); // wrong result based on cldr41 } else { test.equal(str.formatChoice(1000000), "The items are many"); @@ -3306,8 +3306,8 @@ module.exports.teststrings = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(0), "There are no items."); } else { test.equal(str.formatChoice(0), "Default items"); @@ -3337,8 +3337,8 @@ module.exports.teststrings = { test.ok(str !== null); var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(0), "There are no items."); } else { test.equal(str.formatChoice(0), "The items are many"); @@ -3866,7 +3866,7 @@ module.exports.teststrings = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; + var cldrVersion = Number(process.versions["cldr"]); if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(0), "There are no items."); } else { @@ -3940,7 +3940,7 @@ module.exports.teststrings = { test.ok(str !== null); if (ilib._getPlatform() === "nodejs") { - var cldrVersion = process.versions["cldr"]; + var cldrVersion = Number(process.versions["cldr"]); if (Number(cldrVersion) < 36) { // // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(3e6), "The items are many"); } else if (Number(cldrVersion) >= 36 && Number(cldrVersion) < 40 ) { @@ -3964,11 +3964,11 @@ module.exports.teststrings = { test.ok(str !== null); if (ilib._getPlatform() === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(3e6), "The items are many"); } - else if (Number(cldrVersion) >= 36 && Number(cldrVersion) < 40 ) { + else if (cldrVersion >= 36 && cldrVersion < 40 ) { test.equal(str.formatChoice(3e6), "Default items"); // wrong result based on cldr41 } else { test.equal(str.formatChoice(3e6), "The items are many"); @@ -3989,10 +3989,10 @@ module.exports.teststrings = { test.ok(str !== null); if (ilib._getPlatform() === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(1000000), "The items are many"); - } else if (Number(cldrVersion) >= 36 && Number(cldrVersion) < 40 ) { + } else if (cldrVersion >= 36 && cldrVersion < 40 ) { test.equal(str.formatChoice(1000000), "Default items"); // wrong result based on cldr41 } else { test.equal(str.formatChoice(1000000), "The items are many"); @@ -4022,10 +4022,10 @@ module.exports.teststrings = { test.ok(str !== null); if (ilib._getPlatform() === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { test.equal(str.formatChoice(5e6), "The items are many"); - } else if (Number(cldrVersion) >= 36 && Number(cldrVersion) < 38) { + } else if (cldrVersion >= 36 && cldrVersion < 38) { test.equal(str.formatChoice(5e6), "Default items"); // wrong result based on cldr41 } else { test.equal(str.formatChoice(5e6), "The items are many"); @@ -4122,8 +4122,8 @@ module.exports.teststrings = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(5.2), "The items are few"); } else { test.equal(str.formatChoice(5.2), "Default items"); // wrong result based on cldr41 @@ -4240,8 +4240,8 @@ module.exports.teststrings = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(0.0), "There are no items."); } else { test.equal(str.formatChoice(0.0), "Default items"); @@ -4291,8 +4291,8 @@ module.exports.teststrings = { test.ok(str !== null); var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { test.equal(str.formatChoice(1.5), "Default items"); } else { test.equal(str.formatChoice(1.5), "The item is one"); @@ -4600,8 +4600,8 @@ module.exports.teststrings = { test.ok(str !== null); var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { // Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { // Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(3.1e6), "The items are many"); } else { test.equal(str.formatChoice(3.1e6), "Default items"); // wrong result based on cldr41 @@ -4631,8 +4631,8 @@ module.exports.teststrings = { test.ok(str !== null); var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) {// Intl.PluralRules doesn't support this locale until this version. + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) {// Intl.PluralRules doesn't support this locale until this version. test.equal(str.formatChoice(2.1e6), "The items are many"); } else { test.equal(str.formatChoice(2.1e6), "Default items"); // wrong result based on cldr41 diff --git a/js/test/units/testunitfmt_be_BY.js b/js/test/units/testunitfmt_be_BY.js index 9c03f39cbf..5ffd945a34 100644 --- a/js/test/units/testunitfmt_be_BY.js +++ b/js/test/units/testunitfmt_be_BY.js @@ -88,8 +88,8 @@ module.exports.testunitfmt_be_BY = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { test.equal(str, "-16,666666666666668 градусы Цэльсія"); } else { test.equal(str, "-16,666666666666668 градуса Цэльсія"); diff --git a/js/test/units/testunitfmt_usages.js b/js/test/units/testunitfmt_usages.js index 3f95179327..1a53dfe41d 100644 --- a/js/test/units/testunitfmt_usages.js +++ b/js/test/units/testunitfmt_usages.js @@ -2791,8 +2791,8 @@ module.exports.testunitfmt_usages = { var str = uf.format(m1); var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { test.equal(str, "3,2 кубічныя метры"); } else { test.equal(str, "3,2 кубічнага метра"); @@ -2802,7 +2802,6 @@ module.exports.testunitfmt_usages = { } else { test.equal(str, "3,2 кубічныя метры"); } - test.done(); }, @@ -2936,8 +2935,8 @@ module.exports.testunitfmt_usages = { var platform = ilib._getPlatform(); if (platform === "nodejs") { - var cldrVersion = process.versions["cldr"]; - if (Number(cldrVersion) < 36) { + var cldrVersion = Number(process.versions["cldr"]); + if (cldrVersion < 36) { test.equal(str, "3,2 кубічныя метры"); } else { test.equal(str, "3,2 кубічнага метра"); diff --git a/package.json b/package.json index bb5262c79b..150e0a2590 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ilib", - "version": "14.15.0", + "version": "14.15.1", "main": "js/index.js", "description": "iLib is a cross-engine library of internationalization (i18n) classes written in pure JS", "keywords": [