Update mg/dL to mmol/L conversion

This commit is contained in:
Timothy Allen 2024-05-20 15:32:13 +02:00
parent af791b6301
commit 3f4b473c25

View File

@ -121,9 +121,15 @@ export default class NightscoutExtension extends Extension {
let displayGlucoseValue = glucoseValue;
let displayDelta = delta;
if (units === 'mmol/L') {
displayGlucoseValue /= 18.018;
// Based on the molar mass of glucose, conversion
// is 18.0156 (older value sometimes used is 18.0182)
//
// https://pubchem.ncbi.nlm.nih.gov/compound/glucose
//displayGlucoseValue /= 18.0182;
displayGlucoseValue /= 18.0156;
displayGlucoseValue = displayGlucoseValue.toFixed(1);
displayDelta /= 18.018;
//displayDelta /= 18.0182;
displayDelta /= 18.0156;
displayDelta = displayDelta.toFixed(2);
}