Has Node.js Currency symbol for Australian dollar, AUD, been changed after v12?

77 Views Asked by At
(100.2).toLocaleString('en-AU', { style: 'currency', currency: 'AUD' })

From my nvm, above code in nodejs v12 gives 'A$100.20' but in nodejs v14 and v16, it gives '$100.20'

Did I miss something? Not sure why this result differs and what is correct. Could someone refer to the documentation?

BTW, Old Chromium version gives also A$ (Version 44.0.2403.0) But latest gives just $


Tried some docker images to get node and v8 versions

➜ docker run -it whitech/dind:14.21 ash -c "node -v && node -p process.versions.v8 && node -e \"console.log('icu_small:', process.config.variables.icu_small) || console.log((100.2).toLocaleString('en-AU', { style: 'currency', currency: 'AUD' }))\""
v14.21.3
8.4.371.23-node.88
icu_small: true
A$100.20
➜ docker run -it whitech/dind:14.20 ash -c "node -v && node -p process.versions.v8 && node -e \"console.log('icu_small:',process.config.variables.icu_small) || console.log((100.2).toLocaleString('en-AU', { style: 'currency', currency: 'AUD' }))\""
v14.20.1
8.4.371.23-node.87
icu_small: true
A$100.20
➜ docker run -it node:14.19.3-alpine3.14 ash -c "node -v && node -p process.versions.v8 && node -e \"console.log('icu_small:',process.config.variables.icu_small) || console.log((100.2).toLocaleString('en-AU', { style: 'currency', currency: 'AUD' }))\""
v14.19.3
8.4.371.23-node.87
icu_small: false
$100.20

and my local

➜  nvm use 14
Now using node v14.21.3 (npm v6.14.18)
➜  node -v && node -p process.versions.v8 && node -e "console.log('icu_small:',process.config.variables.icu_small) || console.log((100.2).toLocaleString('en-AU', { style: 'currency', currency: 'AUD' }))"
v14.21.3
8.4.371.23-node.88
icu_small: false
$100.20
➜  nvm use 14.19.3
Now using node v14.19.3 (npm v6.14.17)
➜  node -v && node -p process.versions.v8 && node -e "console.log('icu_small:',process.config.variables.icu_small) || console.log((100.2).toLocaleString('en-AU', { style: 'currency', currency: 'AUD' }))"
v14.19.3
8.4.371.23-node.87
icu_small: false
$100.20
➜  nvm use 12
Now using node v12.22.12 (npm v6.14.16)
➜  node -v && node -p process.versions.v8 && node -e "console.log('icu_small:',process.config.variables.icu_small) || console.log((100.2).toLocaleString('en-AU', { style: 'currency', currency: 'AUD' }))"
v12.22.12
7.8.279.23-node.57
icu_small: true
A$100.20

BTW, whitech/dind:14.21 was probably built based on docker:24.0.3-dind and installed nodejs by

apk --no-cache add --repository=https://dl-cdn.alpinelinux.org/alpine/v3.14/main "nodejs<14.99"

** If I used node v12 and install full-icu(1.5.0), and specified it with NODE_ICU_DATA, it gave $100.20 again. Interesting.

NODE_ICU_DATA=./node_modules/full-icu node -e "console.log((100.2).toLocaleString('en-AU', { style: 'currency', currency: 'AUD' }))"
$100.20
0

There are 0 best solutions below