Fixed date formatting bug for api call