> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# matchDateFilterToDateFilterOptionWithPreference()

- Package: [@gooddata/sdk-ui-filters](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-filters/index.md)
- Kind: function
- Stability: alpha
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-ui-filters/src/DateFilter/utils/DateFilterOptionMapping.ts

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Tries to match a preset or a form with the provided value. Prioritizes the provided option if possible.

**Signature:**

```typescript
export declare function matchDateFilterToDateFilterOptionWithPreference(dateFilter: IDashboardDateFilter | undefined, availableOptions: IDateFilterOptionsByType, preferredOptionId: string | undefined): IDateFilterOptionInfo;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| dateFilter | [IDashboardDateFilter](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.idashboarddatefilter/index.md) \| undefined | value to match against |
| availableOptions | [IDateFilterOptionsByType](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-filters/sdk-ui-filters.idatefilteroptionsbytype/index.md) | date options available |
| preferredOptionId | string \| undefined | id of the option that should be matched first if possible |

**Returns:**

[IDateFilterOptionInfo](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-filters/sdk-ui-filters.idatefilteroptioninfo/index.md)

## Remarks

This is to handle cases when user picked a form and filled values that match an existing preset. In those cases we want to show the form as picked even though a preset would otherwise be preferred.
