Repository: strapi/strapi
File: packages/core/content-releases/admin/src/pages/ReleasesSettingsPage.tsx (TypeScript)

Code before:
interface UpdateDefaultTimezone {
  defaultTimezone: string;
}

const ReleasesSettingsPage = () => {
  const { formatMessage } = useIntl();
  const { formatAPIError } = useAPIErrorHandler();
  const { toggleNotification } = useNotification();
  const { data, isLoading: isLoadingSettings } = useGetReleaseSettingsQuery();
  const [updateReleaseSettings, { isLoading: isSubmittingForm }] =
    useUpdateReleaseSettingsMutation();
  const permissions = useTypedSelector(
    (state) => state.admin_app.permissions['settings']?.['releases']
  );
  const {
    allowedActions: { canUpdate },
  } = useRBAC(permissions);

  const { timezoneList } = getTimezones(new Date());

  const handleSubmit = async (
    body: UpdateSettings.Request['body'],
    { setErrors }: FormHelpers<UpdateDefaultTimezone>
  ) => {
    const { defaultTimezone } = body;
    const formattedDefaultTimezone = defaultTimezone?.replace(/ /, '&');
    const isBodyTimezoneValid = timezoneList.some(
      (timezone) => timezone.value === formattedDefaultTimezone
    );
    const newBody =
      !defaultTimezone || !isBodyTimezoneValid
        ? { defaultTimezone: null }
        : { defaultTimezone: formattedDefaultTimezone };

    if (!isBodyTimezoneValid && defaultTimezone) {
      const errorMessage = formatMessage({
        id: 'components.Input.error.validation.combobox.invalid',
        defaultMessage: 'The value provided is not valid.',
      });
      setErrors({
        defaultTimezone: errorMessage,
      });
      toggleNotification({
        type: 'danger',
        message: errorMessage,
      });
      return;
    }

    try {
      const response = await updateReleaseSettings(newBody);

Review comment (suggestion):
```suggestion
    // Replace first space with '&'
    const formattedDefaultTimezone = defaultTimezone?.replace(/ /, '&');
```

Code after:

interface UpdateDefaultTimezone {
  defaultTimezone: string;
}

const ReleasesSettingsPage = () => {
  const { formatMessage } = useIntl();
  const { formatAPIError } = useAPIErrorHandler();
  const { toggleNotification } = useNotification();
  const { data, isLoading: isLoadingSettings } = useGetReleaseSettingsQuery();
  const [updateReleaseSettings, { isLoading: isSubmittingForm }] =
    useUpdateReleaseSettingsMutation();
  const permissions = useTypedSelector(
    (state) => state.admin_app.permissions['settings']?.['releases']
  );
  const {
    allowedActions: { canUpdate },
  } = useRBAC(permissions);

  const { timezoneList } = getTimezones(new Date());

  const handleSubmit = async (
    body: UpdateSettings.Request['body'],
    { setErrors }: FormHelpers<UpdateDefaultTimezone>
  ) => {
    const { defaultTimezone } = body;
    const formattedDefaultTimezone = defaultTimezone;
    const isBodyTimezoneValid = timezoneList.some(
      (timezone) => timezone.value === formattedDefaultTimezone
    );

    if (!isBodyTimezoneValid && defaultTimezone) {
      const errorMessage = formatMessage({
        id: 'components.Input.error.validation.combobox.invalid',
        defaultMessage: 'The value provided is not valid',
      });
      setErrors({
        defaultTimezone: errorMessage,
      });
      toggleNotification({
        type: 'danger',
        message: errorMessage,
      });
      return;
    }

    const newBody =
      !defaultTimezone || !isBodyTimezoneValid
        ? { defaultTimezone: null }
        : { defaultTimezone: formattedDefaultTimezone };