Skip to content

The open alternative to Salesforce, designed for AI.

Patch `formatResult` to pass Date object through (#17483)

Lucas Bordeau3a43e714bb04
diff --git a/packages/twenty-server/src/engine/twenty-orm/utils/format-result.util.ts b/packages/twenty-server/src/engine/twenty-orm/utils/format-result.util.ts
index e935f70ed0f..690dce80f57 100644
--- a/packages/twenty-server/src/engine/twenty-orm/utils/format-result.util.ts
+++ b/packages/twenty-server/src/engine/twenty-orm/utils/format-result.util.ts
@@ -201,19 +201,13 @@ export function formatResult<T>(
continue;
}
- if (typeof rawUpdatedDateTime === 'string') {
+ if (
+ typeof rawUpdatedDateTime === 'string' ||
+ rawUpdatedDateTime instanceof Date ||
+ isPlainObject(rawUpdatedDateTime)
+ ) {
// @ts-expect-error legacy noImplicitAny
newData[dateTimeField.name] = rawUpdatedDateTime;
- } else if (rawUpdatedDateTime instanceof Date) {
- const dateIsoString = rawUpdatedDateTime.toISOString();
-
- // @ts-expect-error legacy noImplicitAny
- newData[dateTimeField.name] = dateIsoString;
- } else if (isPlainObject(rawUpdatedDateTime)) {
- const plainObjectValue = rawUpdatedDateTime;
-
- // @ts-expect-error legacy noImplicitAny
- newData[dateTimeField.name] = plainObjectValue;
} else {
const stringifiedUnknownValue = stringifySafely(rawUpdatedDateTime);