Result from formula to get end date from date range is wrong

Maybe related: Formula adds one day to Max dates