Replace Timeago with momentjs (#1687)

* Replaced timeago with moment.fromNow

* Fixed datetime when best_before_date is empty

* Removed the now unnecessary timeago package

* Removed not longer localization strings

* Check for empty instead of string comparison

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
Tallyrald
2021-11-15 20:05:10 +01:00
committed by GitHub
parent b83e4f53b1
commit 98bf36dbc8
12 changed files with 5 additions and 28 deletions

View File

@@ -16,7 +16,6 @@ Grocy.Components.BatteryCard.Refresh = function(batteryId)
$('#batterycard-battery-edit-button').removeClass("disabled");
$('#batterycard-battery-journal-button').removeClass("disabled");
EmptyElementWhenMatches('#batterycard-battery-last-charged-timeago', __t('timeago_nan'));
RefreshContextualTimeago(".batterycard");
},
function(xhr)

View File

@@ -25,7 +25,6 @@ Grocy.Components.ChoreCard.Refresh = function(choreId)
$("#chorecard-chore-last-tracked-timeago").removeClass("timeago-date-only");
}
EmptyElementWhenMatches('#chorecard-chore-last-tracked-timeago', __t('timeago_nan'));
RefreshContextualTimeago(".chorecard");
},
function(xhr)

View File

@@ -270,7 +270,6 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e)
Grocy.Components.DateTimePicker.GetInputElement().on('input', function(e)
{
$('#datetimepicker-timeago').attr("datetime", Grocy.Components.DateTimePicker.GetValue());
EmptyElementWhenMatches('#datetimepicker-timeago', __t('timeago_nan'));
RefreshContextualTimeago(".datetimepicker-wrapper");
});

View File

@@ -270,7 +270,6 @@ Grocy.Components.DateTimePicker2.GetInputElement().on('keyup', function(e)
Grocy.Components.DateTimePicker2.GetInputElement().on('input', function(e)
{
$('#datetimepicker2-timeago').attr("datetime", Grocy.Components.DateTimePicker2.GetValue());
EmptyElementWhenMatches('#datetimepicker2-timeago', __t('timeago_nan'));
RefreshContextualTimeago(".datetimepicker2-wrapper");
});

View File

@@ -110,8 +110,6 @@ Grocy.Components.ProductCard.Refresh = function(productId)
$("#productcard-product-picture").addClass("d-none");
}
EmptyElementWhenMatches('#productcard-product-last-purchased-timeago', __t('timeago_nan'));
EmptyElementWhenMatches('#productcard-product-last-used-timeago', __t('timeago_nan'));
RefreshContextualTimeago(".productcard");
},
function(xhr)