Fixed date "never" display on stock overview page (again closes #296)

This commit is contained in:
Bernd Bestel
2019-07-07 09:04:40 +02:00
parent 001d5c5d1d
commit 84e6e253ea
2 changed files with 17 additions and 5 deletions

View File

@@ -299,13 +299,15 @@ RefreshContextualTimeago = function()
{
var element = $(this);
var timestamp = element.attr("datetime");
var isNever = timestamp && timestamp.substring(0, 10) == "2999-12-31";
var isToday = timestamp && timestamp.length == 10 && timestamp.substring(0, 10) == moment().format("YYYY-MM-DD");
if (isNever)
{
element.prev().text(__t("Never"));
}
if (isToday)
else if (isToday)
{
element.text(__t("Today"));
}

View File

@@ -164,8 +164,13 @@ $(document).on('click', '.product-consume-button', function(e)
Grocy.FrontendHelpers.EndUiBusy();
toastr.success(toastMessage);
RefreshContextualTimeago();
RefreshStatistics();
// Needs to be delayed because of the animation above the date-text would be wrong if fired immediately...
setTimeout(function ()
{
RefreshContextualTimeago();
}, 520);
},
function(xhr)
{
@@ -239,8 +244,13 @@ $(document).on('click', '.product-open-button', function(e)
Grocy.FrontendHelpers.EndUiBusy();
toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName));
RefreshContextualTimeago();
RefreshStatistics();
// Needs to be delayed because of the animation above the date-text would be wrong if fired immediately...
setTimeout(function()
{
RefreshContextualTimeago();
}, 600);
},
function(xhr)
{