Improve behaviour when setting invalid dates