v4: prevent setting an invalid date
Merge pull request #657 from Koloto/v4/invalidDate

v4: prevent setting an invalid date