Skip to content

date_range class

A control that can display and specify a range of dates or times.

Methods

__init__()

__init__(
    dates=None,
    with_time=False,
    format=None,
    editable=True,
    label_start=None,
    label_end=None,
    width=None,
    on_change=None,
    propagate=None, # App config
    active=True,
    id=None,
    properties=None,
    class_name=None,
    hover_text=None,
) -> None

Create a new date_range element.

Parameters:

Name Type Description Default
dates dynamic(list[datetime])

The dates that this control represents and can modify.
It is typically bound to a list of two datetime object.

None
with_time bool

Whether or not to show the time part of the date.

False
format str

The format to apply to the value. See below.

None
editable dynamic(bool)

Shows the date as a formatted string if not editable.

True
label_start str

The label associated with the first input.

None
label_end str

The label associated with the second input.

None
width Union[str, int]

The width of the date_range element.

None
on_change Union[str, Callable]

A function or the name of a function that is triggered when the value changes.
The callback function receives the following parameters:

  • state (State): the state instance.
  • var_name (str): the bound variable name.
  • value (Any): the updated value.

None
propagate bool

Determines whether the control's value is automatically reflected in the bound application variable.
The default value is defined at the application configuration level by the propagate configuration option.
If True, any change to the control's value is immediately reflected in the variable.

App config
active dynamic(bool)

Indicates if this element is active.
If False, the element is disabled, and user interaction is not allowed.

True
id str

The identifier assigned to the rendered HTML component.
This can be used in callbacks or to target the element for styling.

None
properties dict[str, Any]

A dictionary of additional properties that can be set to the element.

None
class_name dynamic(str)

A space-separated list of CSS class names to be applied to the generated HTML element.
These classes are added to the default taipy-date_range class.

None
hover_text dynamic(str)

The text that is displayed when the user hovers over the element.

None