Skip to content

date class

A control that can display and specify a formatted date, with or without time.

Methods

__init__()

__init__(
    date=None,
    with_time=False,
    format=None,
    editable=True,
    label=None,
    min=None,
    max=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 element.

Parameters:

Name Type Description Default
date dynamic(datetime)

The date that this control represents and can modify.
It is typically bound to a 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 str

The label associated with the input.

None
min dynamic(datetime)

The minimum date to accept for this input.

None
max dynamic(datetime)

The maximum date to accept for this input.

None
width Union[str, int]

The width of the date 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 class.

None
hover_text dynamic(str)

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

None