mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Try catch for NumberFormat.
See https://github.com/TeamPiped/Piped/pull/1675#issuecomment-1302587072
This commit is contained in:
parent
99c4d65864
commit
7ac0940bd5
1 changed files with 11 additions and 6 deletions
17
src/main.js
17
src/main.js
|
@ -88,12 +88,17 @@ const mixin = {
|
|||
return str;
|
||||
},
|
||||
numberFormat(num) {
|
||||
const formatter = Intl.NumberFormat(
|
||||
`${this.getPreferenceString("hl")}-${this.getPreferenceString("region")}`,
|
||||
{
|
||||
notation: "compact",
|
||||
},
|
||||
);
|
||||
var loc = `${this.getPreferenceString("hl")}-${this.getPreferenceString("region")}`;
|
||||
|
||||
try {
|
||||
Intl.getCanonicalLocales(loc);
|
||||
} catch {
|
||||
loc = undefined;
|
||||
}
|
||||
|
||||
const formatter = Intl.NumberFormat(loc, {
|
||||
notation: "compact",
|
||||
});
|
||||
return formatter.format(num);
|
||||
},
|
||||
addCommas(num) {
|
||||
|
|
Loading…
Reference in a new issue