Question: is the default functionality of the yearPicker working as intended?

Hi,
I just played around with the DatePicker Widget for the first time and stumbled accross behaviour which seemed strange to me.

  • by default the YearPicker extends a dropdown including the current year -6/+7 years (see for example in the [WidgetShowcase]<INTERNAL_LINK>, currently 2016 - 2029)
  • to select a different year one can select a different year (for example 2016) and in a next step once again open the YearPicker - now from 2016 on the range of -6/+7 years is available for selection

To select for example a typical birthyear one would have to open the YearPicker a couple of times and “click through” until the desired year is available in the YearPicker.
I somehow expected a more general default option to select from a wider range of years - a scrollbar for example. Just to be clear, it is not affecting my project - I am just curious. :wink:
Is the current behaviour intended or is there an option to let the user chose from an expandable range of years?

Cheers
Ferdinand

Hi Ferdinand,

you can set a custom year range for the date picker widget using the yearRange property (see also examples in [Widgets Showcase]<INTERNAL_LINK>). With that, you can avoid “clicking through” fixed date ranges of -6/+7 years. In a similar way, it is possible to change the default year.

In case your project is using form models, you can do similar settings with the UI Designer.
Each date field offers a “Date Settings” section inside its control settings. The control settings are displayed when double-clicking on a field control inside the UI Designer control grid.

Here is an example with a large date range of -100/+100 (1922-2122) and a relative default year of -32 (1990). The given numbers are relative years to the current one (2022). If preferred, the settings can also be changed to absolute values.
To the left, the settings inside the UI Designer are displayed. To the right, you see the result inside the UI Designer Preview. This is how it would be displayed in your application.

Here is an example with a small date range of -34/-30 (1988-1992) and a relative default year of -32 (1990).

As you can see, the form engine adds a vertical scrollbar automatically if the date range becomes to large.

So the date picker widget is working as expected, I would say.

Cheers,
Henner

Thanks, Henner, with these options the behaviour of the widget makes more sense to me. :slight_smile: