mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-04-19 15:27:40 +00:00
Amend number formating
This commit is contained in:
parent
9e3a696a3d
commit
da9005bb5a
1 changed files with 4 additions and 4 deletions
|
@ -291,13 +291,13 @@ if (config.widgetFamily === 'large') {
|
|||
let total1unit = " Tsd."
|
||||
// if total is a million or more, format as millions and not thousands
|
||||
if ( result.states[selectedState].total > 999999 ){
|
||||
total1 = (result.states[selectedState].total / 1000000).toFixed(0)
|
||||
total1 = (result.states[selectedState].total / 1000000).toLocaleString('de', {maximumFractionDigits: 1})
|
||||
total1unit = " Mio."
|
||||
}
|
||||
let vaccinated1
|
||||
let vaccinated1unit = ""
|
||||
if ( result.states[selectedState].vaccinated > 999999){
|
||||
vaccinated1 = (result.states[selectedState].vaccinated / 1000000).toFixed(0)
|
||||
vaccinated1 = (result.states[selectedState].vaccinated / 1000000).toLocaleString('de', {maximumFractionDigits: 2})
|
||||
vaccinated1unit = " Mio."
|
||||
}
|
||||
else if ( result.states[selectedState].vaccinated > 999 ) {
|
||||
|
@ -341,13 +341,13 @@ if (config.widgetFamily === 'large') {
|
|||
let total2unit = " Tsd."
|
||||
// if total is a million or more, format as millions and not thousands
|
||||
if ( result.total > 999999 ){
|
||||
total2 = (result.total / 1000000).toFixed(0)
|
||||
total2 = (result.total / 1000000).toLocaleString('de', {maximumFractionDigits: 1})
|
||||
total2unit = " Mio."
|
||||
}
|
||||
let vaccinated2 = (result.vaccinated / 1000).toFixed(0)
|
||||
let vaccinated2unit = " Tsd."
|
||||
if ( result.vaccinated > 999999 ){
|
||||
vaccinated2 = (result.vaccinated / 1000000).toFixed(0)
|
||||
vaccinated2 = (result.vaccinated / 1000000).toLocaleString('de', {maximumFractionDigits: 2})
|
||||
vaccinated2unit = " Mio."
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue