fix: guard against invalid date and undefined links field value (#16039)

closes https://github.com/twentyhq/twenty/issues/15854

- Add `isValid()` check in `formatDateISOStringToDateTime` before
calling `formatInTimeZone`
- Add `isDefined()` guard in `getFieldLinkDefinedLinks` (mirrors
`phonesUtils` pattern)

before:


https://github.com/user-attachments/assets/1eb89fa4-70b6-4794-8860-0a42522598b5



https://github.com/user-attachments/assets/781c7d37-c435-4832-98d4-8e6925b51e10



after:


https://github.com/user-attachments/assets/b1c22d25-4e8e-45c3-af98-be1684a5962e



https://github.com/user-attachments/assets/ce084a9d-03b8-4f88-8522-a32cb1b7cf2f

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
nitin
2025-12-29 22:33:24 +05:30
committed by GitHub
parent b56dcd8c22
commit e5e5ae8e1d
5 changed files with 35 additions and 10 deletions
@@ -69,7 +69,9 @@ export const SettingsDataModelFieldPreview = ({
labelIdentifierFieldMetadataItem?.name === fieldMetadataItem.name;
const fieldName = fieldMetadataItem.name;
const recordId = `${objectNameSingular}-${fieldName}-preview`;
const fieldType = fieldMetadataItem.type;
const recordId = `${objectNameSingular}-${fieldName}-${fieldType}-preview`;
const fieldPreviewValue = useFieldPreviewValue({
fieldMetadataItem,
@@ -72,7 +72,7 @@ export const SettingsDataModelRelationFieldPreview = ({
const fieldName = v4();
const recordId = `${relationTargetObjectNameSingular}-${fieldName}-preview`;
const recordId = `${relationTargetObjectNameSingular}-${fieldName}-RELATION-preview`;
const isRelation = fieldMetadataItem.type === FieldMetadataType.RELATION;
const metadata = {