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

datetime
dynamic

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

bool
dynamic

Shows the date as a formatted string if not editable.

True

label

str

The label associated with the input.

None

min

datetime
dynamic

The minimum date to accept for this input.

None

max

datetime
dynamic

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 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 class name.

None

hover_text

str
dynamic

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

None