diff --git a/localization/component_translations.pot b/localization/component_translations.pot index f65749a6..82296d60 100644 --- a/localization/component_translations.pot +++ b/localization/component_translations.pot @@ -12,12 +12,6 @@ msgstr "" "Language: en\n" "X-Domain: grocy/component_translations\n" -msgid "timeago_locale" -msgstr "" - -msgid "timeago_nan" -msgstr "" - msgid "moment_locale" msgstr "" diff --git a/package.json b/package.json index 5d4fdd8a..faa38e88 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "summernote": "^0.8.18", "swagger-ui-dist": "^3.32.1", "tempusdominus-bootstrap-4": "https://github.com/berrnd/tempusdominus-bootstrap-4.git#master", - "timeago": "^1.6.7", "toastr": "^2.1.4" }, "scripts": { diff --git a/public/js/grocy.js b/public/js/grocy.js index e44fe019..8b3123af 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -316,7 +316,6 @@ if (window.localStorage.getItem("sidebar_state") === "collapsed") $("#sidenavToggler").click(); } -$.timeago.settings.allowFuture = true; RefreshContextualTimeago = function(rootSelector = "#page-content") { $(rootSelector + " time.timeago").each(function() @@ -352,7 +351,7 @@ RefreshContextualTimeago = function(rootSelector = "#page-content") } else { - element.timeago("update", timestamp); + element.text(moment(timestamp).fromNow()); } if (isDateWithoutTime) diff --git a/public/viewjs/components/batterycard.js b/public/viewjs/components/batterycard.js index e4ad85ab..6533628d 100644 --- a/public/viewjs/components/batterycard.js +++ b/public/viewjs/components/batterycard.js @@ -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) diff --git a/public/viewjs/components/chorecard.js b/public/viewjs/components/chorecard.js index 861eaa51..64767375 100644 --- a/public/viewjs/components/chorecard.js +++ b/public/viewjs/components/chorecard.js @@ -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) diff --git a/public/viewjs/components/datetimepicker.js b/public/viewjs/components/datetimepicker.js index 4acb74f8..c8951ab8 100644 --- a/public/viewjs/components/datetimepicker.js +++ b/public/viewjs/components/datetimepicker.js @@ -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"); }); diff --git a/public/viewjs/components/datetimepicker2.js b/public/viewjs/components/datetimepicker2.js index 5995fc48..787929f4 100644 --- a/public/viewjs/components/datetimepicker2.js +++ b/public/viewjs/components/datetimepicker2.js @@ -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"); }); diff --git a/public/viewjs/components/productcard.js b/public/viewjs/components/productcard.js index 86ef0f24..97436a25 100644 --- a/public/viewjs/components/productcard.js +++ b/public/viewjs/components/productcard.js @@ -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) diff --git a/views/layout/default.blade.php b/views/layout/default.blade.php index 68738939..4eb3fb8d 100644 --- a/views/layout/default.blade.php +++ b/views/layout/default.blade.php @@ -697,8 +697,6 @@ - - diff --git a/views/stockentries.blade.php b/views/stockentries.blade.php index 211296a9..ea944465 100644 --- a/views/stockentries.blade.php +++ b/views/stockentries.blade.php @@ -241,7 +241,7 @@ {{ $stockEntry->best_before_date }} + @if($stockEntry->best_before_date != "") datetime="{{ $stockEntry->best_before_date }} 23:59:59" @endif>