Ask, reply and learn. Join the community of Akaunting.
Hello guys,
I am having trouble using JP - Yen. In Japan, you do not use "Precision" or "the Japanese yen doesn't use a minor unit".
Example:
var number = 123456.789;
// the Japanese yen doesn't use a minor unit
console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number));
// expected output: "¥123,457"
Then when editing an Expenses->Payments post, the system deletes the decimal values, for example:
Value ¥1,596
https://prntscr.com/n3dk4y
With the form open(Edit Payments):
https://prnt.sc/n3dnv0
The toLocaleString() method returns a string with a language-sensitive representation of this number:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
function eJapan(x){
return x.toLocaleString('ja-JP');
}
console.log(eJapan(123456));
// expected output: "123,456"
console.log(eJapan("123456"));
// expected output: "123456"
console.log(eJapan(NaN));
// expected output: "NaN"
/*CONSOLE LOG RETURN*/
> "123,456" > "123456" > "NaN"
https://prnt.sc/n3dpb5
Showing 1 to 1 of 1 discussions