Default configuration of the DateFilter GoodData.UI component

  • 4 November 2020
  • 3 replies

I’m trying to build a simple UI with the DataFilter component. From the code examples it looks like I need to provide a detailed configuration. Does the GoodData.UI API export any constant which already provides exactly the same DateFilter behavior as in KPI dashboards?


Best answer by Pavel 8 November 2020, 22:07

View original

3 replies

Userlevel 2

Hi @adhira93, the “@gooddata/sdk-ui-filters” package exports exactly the defaultDateFilterOptions constant you are looking for.

Simply put the following code at the beginning of your script:

import { defaultDateFilterOptions } from "@gooddata/sdk-ui-filters";

… and your code will be much simpler. 

We will update the examples, thank you for pointing that out!

Hi @Zuzana Bednarova, I was actually referring to in my original question.

If you take a look at the JavaScript code, there is a very long section starting with

const defaultDateFilterOptions = {

It seems to describe the same date filter options as I can see in KPI dashboards (thanks for confirming that). 

However, I would like to avoid defining this default configuration in my code. Instead, I’d prefer to use some constant provided by the GoodData.UI. Does the GoodData.UI library exports any such constants, and if not, can you please pass that feedback to the team?

Thank you!



This is Zuzana from GoodData support team - hope it is alright if I jump in and try to answer your question.

Have you seen these articles which provide some date filter examples?

There is a short example at the bottom of this page:

And if you are interested in exact KPI's filters, this real example might help:

--- the date filter shown here should carry the same behavior as in KPI dashboards.


Hope this helps but if you are looking for something else and more specific, please let us know.

Have a great day!