From 4a3a897a6509ec561853e766625593cb5e7e9a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Tue, 8 Jul 2025 12:29:46 +0200 Subject: [PATCH] Set createdAt and updatedAt as readonly on the frontend (#13096) This is not the prettiest fix but it's the 5th time I get the feedback from a user that these fields should be readonly, let's have a special case for them --------- Co-authored-by: Lucas Bordeau --- .../record-field/utils/isFieldValueReadOnly.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/twenty-front/src/modules/object-record/record-field/utils/isFieldValueReadOnly.ts b/packages/twenty-front/src/modules/object-record/record-field/utils/isFieldValueReadOnly.ts index 9c542dc65..da57b241a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/utils/isFieldValueReadOnly.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/utils/isFieldValueReadOnly.ts @@ -65,6 +65,16 @@ export const isFieldValueReadOnly = ({ return true; } + const isFieldDateOrDateTime = + fieldType === FieldMetadataType.DATE || + fieldType === FieldMetadataType.DATE_TIME; + const isFieldCreatedAtOrUpdatedAt = + fieldName === 'createdAt' || fieldName === 'updatedAt'; + + if (isFieldDateOrDateTime && isFieldCreatedAtOrUpdatedAt) { + return true; + } + if ( isDefined(fieldType) && (isFieldActor({ type: fieldType }) || isFieldRichText({ type: fieldType }))