Date field format display (#11384)

## Introduction

This PR enables functionality discussed in [Layout Date
Formatting](https://github.com/twentyhq/core-team-issues/issues/97).

### TLDR;
It enables greater control of date formatting at the object's field
level by upgrading all DATE and DATE_TIME fields' settings from:

```ts
{
    displayAsRelativeDate: boolean
}
```

to:

```ts

type FieldDateDisplayFormat = 'full_date' | 'relative_date' | 'date' | 'time' | 'year' | 'custom'

{
    displayFormat: FieldDateDisplayFormat
}
```

PR also includes an upgrade command that will update any existing DATE
and DATE_TIME fields to the new settings value

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
oliver
2025-04-18 01:00:02 -06:00
committed by GitHub
parent dd0ea2366f
commit 53042cc9dc
33 changed files with 690 additions and 250 deletions

View File

@ -1,10 +1,12 @@
import { FieldDateMetadataSettings } from '@/object-record/record-field/types/FieldMetadata';
import { ThemeColor } from 'twenty-ui/theme';
import {
Field,
Object as MetadataObject,
RelationDefinition,
RelationDefinitionType,
} from '~/generated-metadata/graphql';
import { ThemeColor } from 'twenty-ui/theme';
export type FieldMetadataItemOption = {
color: ThemeColor;
@ -35,8 +37,6 @@ export type FieldMetadataItem = Omit<
'id' | 'nameSingular' | 'namePlural'
>;
} | null;
settings?: {
displayAsRelativeDate?: boolean;
};
settings?: FieldDateMetadataSettings;
isLabelSyncedWithName?: boolean | null;
};