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

list[datetime]
dynamic

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

bool
dynamic

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 is updated.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • var_name (str): the variable name.
  • value (Any): the new value.
None

propagate

bool

Allows the control's main value to be automatically propagated.
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 bound application variable.

App config

active

bool
dynamic

Indicates if this component is active.
An inactive component allows no user interaction.

True

id

str

The identifier that is assigned to the rendered HTML component.

None

properties

dict[str, Any]

Bound to a dictionary that contains additional properties for this element.

None

class_name

str
dynamic

The list of CSS class names that are associated with the generated HTML Element.
These class names are added to the default taipy-date_range class name.

None

hover_text

str
dynamic

The information that is displayed when the user hovers over this element.

None