Fix date calculation issue.