SingleDayPicker: "debounce" type of behavior?

I have a SingleDayPicker control that is an input to a callback.

The primary user of this tool prefers to type the dates - rather than select using the calendar dropdown.

What I’m seeing is that the callback fires a little too aggressively.

For example, if the date ‘11/01/2023’ is showing, and the user wants to change it to ‘12/02/2023’, as soon as the ‘11’ is changed to a ‘12’, the callback will fire.

I’m basically looking for a ‘debounce’ type of option.

Is there anything like this? I don’t see it in the documentation.


1 Like

Hi, you could use the dmc date picker:

I’m not sure though. The page is not responsive right now for me.

I believe, @zack_nc meant DatePickerSingle. I second this feature request. It would save unnecessary callbacks. Thanks in advance.

In addition to debounce-like behaviour similar to Input(..., debounce=True), consider introducing value_validated property along with value. The new property value_validated would fire callbacks only when DatePickerSingle component recognised the date typed by the user as a valid date and showed it in the pop-up calendar. The value property will fire always. If debounce=True, then both properties fire only when user removes the focus.

As far as I can see, property date is fired whenever it is changed, but set to None for invalid dates. There seems to be no way of retrieving invalid input, so be it. It would still be nice to have debounce-like behaviour, so that I don’t have to start each callback with

    if date is None:
        raise PreventUpdate