Repository: Avaiga/taipy
File: frontend/taipy-gui/src/components/Taipy/DateSelector.tsx (TypeScript)

Code before:
            }
        } catch (error) {
            console.error(error);
        }
    }, [props.date, tz, withTime, max, min]);

    return (
        <ErrorBoundary FallbackComponent={ErrorFallback}>
            <Tooltip title={hover || ""}>
                <Box id={id} className={`${className} ${getComponentClassName(props.children)}`} sx={boxSx}>
                    {editable ? (
                        withTime ? (
                            analogic ? (
                                <DateTimePicker
                                    {...(startProps as DateTimePickerProps<Date>)}
                                    {...(endProps as DateTimePickerProps<Date>)}
                                    value={value}
                                    onChange={handleChange}
                                    className={getSuffixedClassNames(className, "-picker")}
                                    disabled={!active}
                                    slotProps={textFieldProps}
                                    label={props.label}
                                    format={props.format}
                                    sx={dateSx}
                                    viewRenderers={{
                                        hours: renderTimeViewClock,
                                        minutes: renderTimeViewClock,
                                        seconds: renderTimeViewClock,
                                      }}
                                />
                            ):(
                                <DateTimePicker
                                    {...(startProps as DateTimePickerProps<Date>)}
                                    {...(endProps as DateTimePickerProps<Date>)}
                                    value={value}
                                    onChange={handleChange}
                                    className={getSuffixedClassNames(className, "-picker")}
                                    disabled={!active}
                                    slotProps={textFieldProps}
                                    label={props.label}
                                    format={props.format}
                                    sx={dateSx}
                                />
                            )
                        ) : (
                            <DatePicker
                                {...(startProps as DatePickerProps<Date>)}
                                {...(endProps as DatePickerProps<Date>)}
                                value={value}
                                onChange={handleChange}
                                className={getSuffixedClassNames(className, "-picker")}

Review comment (suggestion):
apply the ternary operator (analogic ? ...) at the viewRenderers property level 
`viewRenderers={analogic ? analogicRenderers : undefined}`

With analogicRenderers defined outside the component

Code after:
            if (min !== undefined) {
                setStartProps((p) => getProps(p, true, getDateTime(min, tz, withTime), withTime));
            }

            if (max !== undefined) {
                setEndProps((p) => getProps(p, false, getDateTime(max, tz, withTime), withTime));
            }
        } catch (error) {
            console.error(error);
        }
    }, [props.date, tz, withTime, max, min]);

    return (
        <ErrorBoundary FallbackComponent={ErrorFallback}>
            <Tooltip title={hover || ""}>
                <Box id={id} className={`${className} ${getComponentClassName(props.children)}`} sx={boxSx}>
                    {editable ? (
                        withTime ? (
                            <DateTimePicker
                                    {...(startProps as DateTimePickerProps<Date>)}
                                    {...(endProps as DateTimePickerProps<Date>)}
                                    value={value}
                                    onChange={handleChange}
                                    className={getSuffixedClassNames(className, "-picker")}
                                    disabled={!active}
                                    slotProps={textFieldProps}
                                    label={props.label}
                                    format={props.format}
                                    sx={dateSx}
                                    viewRenderers={ analogic ? analogicRenderers : undefined }
                                />
                        ) : (
                            <DatePicker
                                {...(startProps as DatePickerProps<Date>)}
                                {...(endProps as DatePickerProps<Date>)}
                                value={value}
                                onChange={handleChange}
                                className={getSuffixedClassNames(className, "-picker")}
                                disabled={!active}
                                slotProps={textFieldProps}
                                label={props.label}
                                format={props.format}
                                sx={dateSx}
                            />
                        )
                    ) : (
                        <Field
                            dataType="datetime"
                            defaultValue={props.defaultDate}
                            value={props.date}
                            format={props.format}