{"record":{"id":"72f2e0f968bfaafd","repo":"marmelab/react-admin","slug":"datefield-cannot-have-showtime-and-showdate-fals","errorCode":null,"errorMessage":"<DateField> cannot have showTime and showDate false at the same time","messagePattern":"<DateField> cannot have showTime and showDate false at the same time","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ra-ui-materialui/src/field/DateField.tsx","lineNumber":60,"sourceCode":"    const props = useThemeProps({\n        props: inProps,\n        name: PREFIX,\n    });\n\n    const {\n        className,\n        emptyText,\n        locales,\n        options,\n        showTime = false,\n        showDate = true,\n        transform = defaultTransform,\n        ...rest\n    } = props;\n    const translate = useTranslate();\n\n    if (!showTime && !showDate) {\n        throw new Error(\n            '<DateField> cannot have showTime and showDate false at the same time'\n        );\n    }\n\n    const value = useFieldValue(props);\n    if (value == null || value === '') {\n        return emptyText ? (\n            <Typography\n                component=\"span\"\n                variant=\"body2\"\n                className={className}\n                {...sanitizeFieldRestProps(rest)}\n            >\n                {emptyText && translate(emptyText, { _: emptyText })}\n            </Typography>\n        ) : null;\n    }\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-ui-materialui/src/field/DateField.tsx#L42-L78","documentation":"<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.","triggerScenarios":"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.","commonSituations":"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}.","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."],"exampleFix":"// before\n<DateField source=\"published_at\" showDate={false} showTime={false} />\n\n// after\n<DateField source=\"published_at\" showTime />","handlingStrategy":"validation","validationCode":"if (!showTime && !showDate) throw new Error('DateField: showTime and showDate cannot both be false');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable at least one of showTime/showDate; drop the component entirely if neither should render.","Double-check computed boolean props feeding these flags."],"tags":["react-admin","datefield","invalid-props","configuration"],"backgroundTag":"invalid-prop-combination","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}