Fix bug in end date validation for history api