diff --git a/public/js/grocy.js b/public/js/grocy.js index 87ba0b98..b81940c5 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -344,6 +344,12 @@ RefreshContextualTimeago = function(rootSelector = "#page-content") return } + if (!moment(timestamp).isValid()) + { + element.text("") + return + } + var isNever = timestamp && timestamp.substring(0, 10) == "2999-12-31"; var isToday = timestamp && timestamp.substring(0, 10) == moment().format("YYYY-MM-DD"); var isDateWithoutTime = element.hasClass("timeago-date-only"); @@ -425,9 +431,15 @@ Grocy.FrontendHelpers.ShowGenericError = function(message, exception) toastr.error(__t(message) + '

' + __t('Click to show technical details'), '', { onclick: function() { + var errorDetails = JSON.stringify(exception, null, 4); + if (typeof exception === "object" && exception !== null && exception.hasOwnProperty("error_message")) + { + errorDetails = exception.error_message; + } + bootbox.alert({ title: __t('Error details'), - message: '
' + JSON.stringify(exception, null, 4) + '
', + message: '

' + errorDetails + '

', closeButton: false }); }