Fixed bug with date serialization

A bug submited 'null' values to the database which caused the
application to crash when they were fetched.
Also, we added a check on input to prevent old dates.