From d4d7bea7fbcc34895aa7f5831fe07721bfe74dad Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Sun, 8 Oct 2023 09:50:04 +0200 Subject: [PATCH] Fix `oh-stepper` not working if step is an integer (#2109) Regression from #2090. Fixes `Uncaught TypeError: Cannot read properties of undefined (reading 'length')` being thrown if the step property is an integer value, e.g. 1 or 1.0. Signed-off-by: Florian Hotze --- .../web/src/components/widgets/system/oh-stepper.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-stepper.vue b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-stepper.vue index 370442f566..703d776411 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-stepper.vue +++ b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-stepper.vue @@ -48,7 +48,7 @@ export default { // uses the number of decimals in the step config to round the provided number if (!this.config.step) return value const nbDecimals = Number(this.config.step).toString().replace(',', '.').split('.')[1] - return parseFloat(Number(value)).toFixed(nbDecimals.length) + return parseFloat(Number(value)).toFixed(nbDecimals ? nbDecimals.length : 0) }, onChange (value) { const applyOffset = (value) => (typeof this.config.offset === 'number') ? Number(this.toStepFixed(value - this.config.offset)) : value