diff --git a/src/js/utilJS.js b/src/js/utilJS.js index 17431b10bdaa9c0f91cba21be764550f6a9695a8..e906a3a86ba92dde625d736856e001f6d85db73d 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -921,7 +921,17 @@ 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) { + inches += ' inches'; + } else if (inches < 1) { + 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"