mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-10-27 16:24:31 -04:00
fix: round ingredient amounts when not using fractions (#4470)
This commit is contained in:
@@ -54,7 +54,7 @@ export function useParsedIngredientText(ingredient: RecipeIngredient, disableAmo
|
|||||||
// casting to number is required as sometimes quantity is a string
|
// casting to number is required as sometimes quantity is a string
|
||||||
if (quantity && Number(quantity) !== 0) {
|
if (quantity && Number(quantity) !== 0) {
|
||||||
if (unit && !unit.fraction) {
|
if (unit && !unit.fraction) {
|
||||||
returnQty = (quantity * scale).toString();
|
returnQty = Number((quantity * scale).toPrecision(3)).toString();
|
||||||
} else {
|
} else {
|
||||||
const fraction = frac(quantity * scale, 10, true);
|
const fraction = frac(quantity * scale, 10, true);
|
||||||
if (fraction[0] !== undefined && fraction[0] > 0) {
|
if (fraction[0] !== undefined && fraction[0] > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user