Fix bug of date checking.