Fixing datepicker invalid input problem when date is entered manually

Fixes #325