Display just "unlimited" on the product card for the average shelf life if it is > 200 years

This commit is contained in:
Bernd Bestel
2019-09-27 14:04:44 +02:00
parent 765f908966
commit 4aa575e0e8
3 changed files with 8 additions and 0 deletions

View File

@@ -52,6 +52,10 @@ Grocy.Components.ProductCard.Refresh = function(productId)
{
$('#productcard-product-average-shelf-life').text(__t("Unknown"));
}
else if (parseInt(productDetails.average_shelf_life_days) > 73000) // > 200 years aka forever
{
$('#productcard-product-average-shelf-life').text(__t("Unlimited"));
}
else
{
$('#productcard-product-average-shelf-life').text(moment.duration(productDetails.average_shelf_life_days, "days").humanize());