fixing endDate bug