mirror of
https://github.com/TheThomaas/my-online-cookbook.git
synced 2026-01-11 20:21:49 +00:00
change adaptQuantity function
This commit is contained in:
parent
20e9346f6d
commit
7ea7399c51
|
|
@ -66,7 +66,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function adaptQuantity (ingredient, originalServings, currentServings) {
|
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>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Loading…
Reference in a new issue