Improved date display for dates of today and no time

Instead of the hours since midnight now just "Today" will be shown
This commit is contained in:
Bernd Bestel
2019-07-06 17:19:28 +02:00
parent df529c3c0b
commit c6c10c87e4
7 changed files with 18 additions and 5 deletions

View File

@@ -12,9 +12,9 @@ Grocy.Components.ProductCard.Refresh = function(productId)
$('#productcard-product-stock-amount').text(stockAmount);
$('#productcard-product-stock-qu-name').text(__n(stockAmount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural));
$('#productcard-product-last-purchased').text((productDetails.last_purchased || __t('never')).substring(0, 10));
$('#productcard-product-last-purchased-timeago').text($.timeago(productDetails.last_purchased || ''));
$('#productcard-product-last-purchased-timeago').attr("datetime", productDetails.last_purchased || '');
$('#productcard-product-last-used').text((productDetails.last_used || __t('never')).substring(0, 10));
$('#productcard-product-last-used-timeago').text($.timeago(productDetails.last_used || ''));
$('#productcard-product-last-used-timeago').attr("datetime", productDetails.last_used || '');
$('#productcard-product-location').text(productDetails.location.name);
$('#productcard-product-spoil-rate').text(parseFloat(productDetails.spoil_rate_percent).toLocaleString(undefined, { style: "percent" }));
@@ -71,6 +71,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
EmptyElementWhenMatches('#productcard-product-last-purchased-timeago', __t('timeago_nan'));
EmptyElementWhenMatches('#productcard-product-last-used-timeago', __t('timeago_nan'));
RefreshContextualTimeago();
},
function(xhr)
{