Maybe instead of `type`, you could call it a `format_func` / `cast_func`, specify `parse_date` as `format_func` for those two attributes and get rid of this if.