1
0
Fork 0
mirror of https://github.com/TheThomaas/my-online-cookbook.git synced 2026-01-10 20:01:47 +00:00

change adaptQuantity function

This commit is contained in:
TheThomaas 2023-07-08 11:46:30 +02:00
parent 20e9346f6d
commit 7ea7399c51

View file

@ -66,7 +66,7 @@
<script>
function adaptQuantity (ingredient, originalServings, currentServings) {
return ingredient.replace(/(\d|\.|,)+/, match => Number(Math.round(parseFloat(match.replace(',', '.')) * currentServings / originalServings + 'e' + 2) + 'e-' + 2));
return ingredient.replace(/(\d|\.|,)+/, match => Number(Math.round(parseFloat(match) * currentServings / originalServings + 'e' + 2) + 'e-' + 2));
}
</script>
{% endblock %}