Skip to content

Commit

Permalink
Is this used?
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMalfait committed Sep 27, 2024
1 parent 8ad4774 commit 34f8e9b
Showing 1 changed file with 1 addition and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import {
VariableDateViewFilterValueUnit,
} from '@/views/utils/view-filter-value/resolveDateViewFilterValue';
import { resolveFilterValue } from '@/views/utils/view-filter-value/resolveFilterValue';
import { useEffect, useState } from 'react';
import { useState } from 'react';
import { isDefined } from 'twenty-ui';
import { z } from 'zod';
import { FieldMetadataType } from '~/generated-metadata/graphql';

export const ObjectFilterDropdownDateInput = () => {
Expand Down Expand Up @@ -48,29 +47,6 @@ export const ObjectFilterDropdownDateInput = () => {
const isDateTimeInput =
filterDefinitionUsedInDropdown?.type === FieldMetadataType.DateTime;

useEffect(() => {
if (selectedFilter?.operand !== ViewFilterOperand.IsRelative) {
if (!filterDefinitionUsedInDropdown || !selectedOperandInDropdown) return;

const now = new Date();
const dateResult = z.coerce.date().safeParse(selectedFilter?.value);
const date = dateResult.success ? dateResult.data : now;
const value = date.toISOString();
const displayValue = isDateTimeInput
? date.toLocaleString()
: date.toLocaleDateString();

selectFilter?.({
id: selectedFilter?.id ? selectedFilter.id : v4(),
fieldMetadataId: filterDefinitionUsedInDropdown.fieldMetadataId,
value,
displayValue,
operand: selectedOperandInDropdown,
definition: filterDefinitionUsedInDropdown,
});
}
}, [selectedOperandInDropdown]);

const handleAbsoluteDateChange = (newDate: Date | null) => {
setInternalDate(newDate);

Expand Down

0 comments on commit 34f8e9b

Please sign in to comment.