diff --git a/public/js/grocy.js b/public/js/grocy.js index c634b035..70c28d2e 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -338,7 +338,7 @@ RefreshContextualTimeago = function(rootSelector = "#page-content") var timestamp = element.attr("datetime"); - if (timestamp.isEmpty()) + if (timestamp.isEmpty() || timestamp.length < 10) { element.text("") return diff --git a/public/viewjs/components/datetimepicker.js b/public/viewjs/components/datetimepicker.js index 6c19b91d..32c51d90 100644 --- a/public/viewjs/components/datetimepicker.js +++ b/public/viewjs/components/datetimepicker.js @@ -238,6 +238,9 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e) } } + $('#datetimepicker-timeago').attr("datetime", Grocy.Components.DateTimePicker.GetValue()); + RefreshContextualTimeago(".datetimepicker-wrapper"); + //Custom validation value = Grocy.Components.DateTimePicker.GetValue(); dateObj = moment(value, format, true); diff --git a/public/viewjs/components/datetimepicker2.js b/public/viewjs/components/datetimepicker2.js index 5543aaef..a99714ee 100644 --- a/public/viewjs/components/datetimepicker2.js +++ b/public/viewjs/components/datetimepicker2.js @@ -238,6 +238,9 @@ Grocy.Components.DateTimePicker2.GetInputElement().on('keyup', function(e) } } + $('#datetimepicker2-timeago').attr("datetime", Grocy.Components.DateTimePicker2.GetValue()); + RefreshContextualTimeago(".datetimepicker2-wrapper"); + //Custom validation value = Grocy.Components.DateTimePicker2.GetValue(); dateObj = moment(value, format, true);