diff --git a/src/js/utilJS.js b/src/js/utilJS.js index 17431b10bdaa9c0f91cba21be764550f6a9695a8..1c50d1b4386a575f5d4325de94808caa93b118f3 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -921,7 +921,19 @@ window.getSlaveTrustClass = /** @param {App.Entity.SlaveState} slave */ function // takes an integer e.g. $activeSlave.hLength, returns a string in the format 10 inches window.cmToInchString = function(s) { - return Math.round(s/2.54) + (Math.round(s/2.54) === 1?' inch':' inches'); + let inches = Math.round(s/2.54); + if (inches === 0) { + if (s === 0) { + inches += ' inches'; + } else { + inches = 'less than an inch'; + } + } else if (inches === 1){ + inches += ' inch'; + } else { + inches += ' inches'; + } + return inches; }; // takes an integer e.g. $activeSlave.height, returns a string in the format 6'5"