Fixed shift allocation.

It was not calculating the correct dates so rooms were wrongly shown as occupied.
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.
Merge pull request #617 from cfscosta/3.14.x

Fixed shift allocation.