fixes 6106 month/year datepicker-ui not working (#6199)

fixes #6106

---------

Co-authored-by: Marie <51697796+ijreilly@users.noreply.github.com>
Co-authored-by: Adithya Thejas S <adithyathejass.1997@gmail.com>
Co-authored-by: Rob Luke <code@robertluke.net>
Co-authored-by: rostaklein <r.klein@make.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Faisal-imtiyaz123
2024-07-13 16:07:30 +05:30
committed by GitHub
parent 12c68fd77f
commit 1e48fe2b74
3 changed files with 53 additions and 14 deletions

View File

@ -3,9 +3,12 @@ import { v4 } from 'uuid';
import { useFilterDropdown } from '@/object-record/object-filter-dropdown/hooks/useFilterDropdown';
import { InternalDatePicker } from '@/ui/input/components/internal/date/components/InternalDatePicker';
import { useState } from 'react';
import { isDefined } from '~/utils/isDefined';
export const ObjectFilterDropdownDateInput = () => {
const [internalDate, setInternalDate] = useState<Date | null>(new Date());
const {
filterDefinitionUsedInDropdownState,
selectedOperandInDropdownState,
@ -24,8 +27,9 @@ export const ObjectFilterDropdownDateInput = () => {
const selectedFilter = useRecoilValue(selectedFilterState);
const handleChange = (date: Date | null) => {
if (!filterDefinitionUsedInDropdown || !selectedOperandInDropdown) return;
setInternalDate(date);
if (!filterDefinitionUsedInDropdown || !selectedOperandInDropdown) return;
selectFilter?.({
id: selectedFilter?.id ? selectedFilter.id : v4(),
fieldMetadataId: filterDefinitionUsedInDropdown.fieldMetadataId,
@ -40,7 +44,7 @@ export const ObjectFilterDropdownDateInput = () => {
return (
<InternalDatePicker
date={new Date()}
date={internalDate}
onChange={handleChange}
onMouseSelect={handleChange}
/>