From 3f4b473c25ec4d1a9ff0b982321e06ecbee63000 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 20 May 2024 15:32:13 +0200 Subject: [PATCH] Update mg/dL to mmol/L conversion --- nightscout-follower@treehouse.org.za/extension.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nightscout-follower@treehouse.org.za/extension.js b/nightscout-follower@treehouse.org.za/extension.js index 6ea81ef..3a7e6e7 100644 --- a/nightscout-follower@treehouse.org.za/extension.js +++ b/nightscout-follower@treehouse.org.za/extension.js @@ -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); }