Extracts `parseDate` to a function