Fixed endDate calculation error.