Allow best before date on purchase/inventory to be today or in the past, but display a hint when so (closes #172)

This commit is contained in:
Bernd Bestel
2019-03-10 16:02:13 +01:00
parent 3d485d4850
commit bfcd05473a
5 changed files with 32 additions and 11 deletions

View File

@@ -193,6 +193,19 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e)
{
element.setCustomValidity("");
}
var earlierThanLimit = Grocy.Components.DateTimePicker.GetInputElement().data("earlier-than-limit");
if (!earlierThanLimit.isEmpty())
{
if (moment(value).isBefore(moment(earlierThanLimit)))
{
$("#datetimepicker-earlier-than-info").removeClass("d-none");
}
else
{
$("#datetimepicker-earlier-than-info").addClass("d-none");
}
}
}
// "Click" the shortcut checkbox when the shortcut value was