Allow empty date(time) inputs when the field is not required (fixes #462(

This commit is contained in:
Bernd Bestel
2020-01-03 13:50:10 +01:00
parent 0be672aa48
commit 675bf25927
2 changed files with 7 additions and 1 deletions

View File

@@ -221,7 +221,10 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e)
var element = Grocy.Components.DateTimePicker.GetInputElement()[0];
if (!dateObj.isValid())
{
element.setCustomValidity("error");
if ($(element).hasAttr("required"))
{
element.setCustomValidity("error");
}
}
else
{