diff --git a/resources/js/src/app/components/item/QuantityInput.vue b/resources/js/src/app/components/item/QuantityInput.vue index fd9054dc48..aabe946920 100644 --- a/resources/js/src/app/components/item/QuantityInput.vue +++ b/resources/js/src/app/components/item/QuantityInput.vue @@ -277,7 +277,7 @@ export default { } else { - diff = formatFloat(value % this.compInterval, this.compDecimals, true); + diff = formatFloat(value % this.compInterval, this.compDecimals, false); } if (diff > 0 && diff !== this.compInterval) @@ -294,7 +294,7 @@ export default { } // cut fraction - value = formatFloat(value, this.compDecimals); + value = formatFloat(value, this.compDecimals, false); if (value !== this.compValue) { @@ -312,7 +312,9 @@ export default { if (!isNullOrUndefined(this.min) && this.variationBasketQuantity >= this.min && this.variationBasketQuantity !== 0) { // set the minimum value to the interval, if the item is already in the basket - this.compMin = this.compInterval; + if (Number.isInteger(this.compMin)) { + this.compMin = this.compInterval; + } } else if (this.variationBasketQuantity === 0) { diff --git a/resources/js/src/app/helper/number.js b/resources/js/src/app/helper/number.js index 2e7a713e4c..e203e812f6 100644 --- a/resources/js/src/app/helper/number.js +++ b/resources/js/src/app/helper/number.js @@ -71,5 +71,8 @@ export function formatFloat(value, decimals, round) // return NaN return 1 / 0; } + + value = Math.floor(value * 100) / 100; + return parseFloat(value.toFixed(decimals)); }