Fixing error when dates are not provided.

When dates are not provided this was throwing an error (because DateTime::createFromFormat returns false if the date supplied is not valid). This change will just null out any dates that aren't provided.