Include Date fields in aggregate operations on dates (#9479)
Follow-up on https://github.com/twentyhq/twenty/pull/9444/files - I had forgotten to include Date field types (in addition to DateTime)
This commit is contained in:
@ -1,12 +1,13 @@
|
||||
import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
|
||||
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
|
||||
import { isFieldMetadataDateKind } from 'twenty-shared';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const convertAggregateOperationToExtendedAggregateOperation = (
|
||||
aggregateOperation: AGGREGATE_OPERATIONS,
|
||||
fieldType?: FieldMetadataType,
|
||||
): ExtendedAggregateOperations => {
|
||||
if (fieldType === FieldMetadataType.DateTime) {
|
||||
if (isFieldMetadataDateKind(fieldType) === true) {
|
||||
if (aggregateOperation === AGGREGATE_OPERATIONS.min) {
|
||||
return 'EARLIEST';
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
||||
import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
|
||||
import { capitalize } from 'twenty-shared';
|
||||
import { capitalize, isFieldMetadataDateKind } from 'twenty-shared';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
type NameForAggregation = {
|
||||
@ -55,7 +55,7 @@ export const getAvailableAggregationsFromObjectFields = (
|
||||
};
|
||||
}
|
||||
|
||||
if (field.type === FieldMetadataType.DateTime) {
|
||||
if (isFieldMetadataDateKind(field.type) === true) {
|
||||
acc[field.name] = {
|
||||
...acc[field.name],
|
||||
[AGGREGATE_OPERATIONS.min]: `min${capitalize(field.name)}`,
|
||||
|
||||
Reference in New Issue
Block a user