Improving date validation make sure valid dates and date times  are returned with YYYY-MM-DD and YYYY-MM-DD HH:MM:SS format respectively
BDD for validating date