Validate that best before date is min. today

This commit is contained in:
Bernd Bestel 2017-04-21 19:15:03 +02:00
parent 4b0f0141c9
commit 8e40c50cc1
2 changed files with 14 additions and 0 deletions

View File

@ -187,6 +187,13 @@ $(function()
{ {
return 'Wrong date format, needs to be YYYY-MM-DD'; return 'Wrong date format, needs to be YYYY-MM-DD';
} }
else if (moment($el.val()).isValid())
{
if (moment($el.val()).isBefore(moment(), 'day'))
{
return 'This value cannot be before today.';
}
}
}, },
'notequal': function($el) 'notequal': function($el)
{ {

View File

@ -192,6 +192,13 @@ $(function()
{ {
return 'Wrong date format, needs to be YYYY-MM-DD'; return 'Wrong date format, needs to be YYYY-MM-DD';
} }
else if (moment($el.val()).isValid())
{
if (moment($el.val()).isBefore(moment(), 'day'))
{
return 'This value cannot be before today.';
}
}
} }
} }
}); });