Sfoglia il codice sorgente

number formatters in Trio/Sources/Helpers/Formatters.swift use regional formatting

Milen Minev 10 mesi fa
parent
commit
d264a648f1

+ 2 - 1
Trio/Sources/Helpers/Formatters.swift

@@ -84,9 +84,10 @@ extension Formatter {
     static let bolusFormatter: NumberFormatter = {
         let formatter = NumberFormatter()
         formatter.numberStyle = .decimal
+        formatter.locale = .current
         formatter.minimumIntegerDigits = 0
         formatter.maximumFractionDigits = 2
-        formatter.decimalSeparator = "."
+        // formatter.decimalSeparator = "."
         return formatter
     }()
 

+ 3 - 2
Trio/Sources/Modules/Treatments/View/ForecastChart.swift

@@ -59,8 +59,9 @@ struct ForecastChart: View {
 
             HStack {
                 Image(systemName: "syringe.fill")
-                Text("\(Formatter.decimalFormatterWithTwoFractionDigits.string(from: state.amount as NSNumber) ?? state.amount.description) U")
-
+                Text(
+                    "\(Formatter.bolusFormatter.string(from: state.amount as NSNumber) ?? state.amount.description) U"
+                )
             }
 
             .font(.footnote)