Fix readonly date still editable (#19334)

Fixes #19319

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Rohit Sekh
2026-04-06 12:12:25 +05:30
committed by GitHub
parent bad488494f
commit 3747af4b5a
3 changed files with 117 additions and 1 deletions
@@ -42,9 +42,14 @@ const StyledInput = styled.input<{ hasError?: boolean }>`
type DatePickerInputProps = {
onChange?: (date: string | null) => void;
date: string | null;
readonly?: boolean;
};
export const DatePickerInput = ({ date, onChange }: DatePickerInputProps) => {
export const DatePickerInput = ({
date,
onChange,
readonly = false,
}: DatePickerInputProps) => {
const { dateFormat } = useDateTimeFormat();
const [internalDate, setInternalDate] = useState(date);
@@ -105,6 +110,7 @@ export const DatePickerInput = ({ date, onChange }: DatePickerInputProps) => {
<StyledInputContainer>
<StyledInput
type="text"
disabled={readonly}
ref={ref as any}
value={value}
onChange={() => {}} // Prevent React warning