marmelab/react-admin · error · Error
<DateField> cannot have showTime and showDate false at the s
Error message
<DateField> cannot have showTime and showDate false at the same time
What it means
<DateField> formats dates using two independent toggles: `showDate` (render the date part) and `showTime` (render the time part). If both are false, nothing would be rendered, so the field throws to flag the invalid configuration instead of silently producing an empty output.
Source
Thrown at packages/ra-ui-materialui/src/field/DateField.tsx:60
const props = useThemeProps({
props: inProps,
name: PREFIX,
});
const {
className,
emptyText,
locales,
options,
showTime = false,
showDate = true,
transform = defaultTransform,
...rest
} = props;
const translate = useTranslate();
if (!showTime && !showDate) {
throw new Error(
'<DateField> cannot have showTime and showDate false at the same time'
);
}
const value = useFieldValue(props);
if (value == null || value === '') {
return emptyText ? (
<Typography
component="span"
variant="body2"
className={className}
{...sanitizeFieldRestProps(rest)}
>
{emptyText && translate(emptyText, { _: emptyText })}
</Typography>
) : null;
}
View on GitHub (pinned to 051f511bb0)
Solutions
- Set at least one of the props true: `<DateField source="published_at" showTime />` for time-only, or `showDate` (default true) for date-only.
- If you want neither rendered, remove the <DateField> instead of disabling both.
- Check any variables feeding showDate/showTime so both cannot be false.
Example fix
// before
<DateField source="published_at" showDate={false} showTime={false} />
// after
<DateField source="published_at" showTime /> Defensive patterns
Strategy: validation
Validate before calling
if (!showTime && !showDate) throw new Error('DateField: showTime and showDate cannot both be false'); Prevention
- Enable at least one of showTime/showDate; drop the component entirely if neither should render.
- Double-check computed boolean props feeding these flags.
When it happens
Trigger: Passing both `showDate={false}` and `showTime={false}` (or showTime={false} plus a falsy showDate from a variable) to <DateField>; computing one of them from a constant/prop that is false.
Common situations: Trying to hide the date portion by setting showDate={false} and also leaving showTime={false} (the default); conditional rendering logic that disables both switches; copying a config for a time-only field but forgetting showTime={true}.
Related errors
- useReferenceFieldController: missing reference prop. You mus
- Missing dataProvider prop. React-admin requires a valid data
- The admin is empty. Please provide an empty component, or pa
- When using a custom Resource element, it must have a static
- You can only provide one function child to AdminRouter
AI-assisted analysis of marmelab/react-admin@051f511bb0 (2026-08-30).
Data as JSON: /api/errors/72f2e0f968bfaafd.
Report an issue: GitHub.