From fa686428031f61c5a91330287be9c3d210d69a82 Mon Sep 17 00:00:00 2001
From: lowercase-donkey <lowercasedonkey@gmail.com>
Date: Thu, 14 Mar 2019 00:24:15 -0400
Subject: [PATCH] cmToInch expansion

---
 src/js/utilJS.js | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/js/utilJS.js b/src/js/utilJS.js
index 17431b10bda..e906a3a86ba 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"
-- 
GitLab