class documentation

The DateTime type converts date strings into `datetime` objects. The format strings which are checked are configurable, but default to some common (non-timezone aware) ISO 8601 formats. When specifying *DateTime* formats, you should only pass a list or a tuple. Other iterables, like generators, may lead to surprising results. The format strings are processed using ``datetime.strptime``, and this consequently defines the format strings which are allowed. Parsing is tried using each format, in order, and the first format which parses successfully is used. :param formats: A list or tuple of date format strings, in the order in which they should be tried. Defaults to ``'%Y-%m-%d'``, ``'%Y-%m-%dT%H:%M:%S'``, ``'%Y-%m-%d %H:%M:%S'``.

Method __init__ Undocumented
Method __repr__ Undocumented
Method convert Convert the value to the correct type. This is not called if the value is ``None`` (the missing value).
Method get_metavar Returns the metavar default for this param if it provides one.
Method to_info_dict Gather information that could be useful for a tool generating user-facing documentation.
Class Variable name Undocumented
Instance Variable formats Undocumented
Method _try_to_convert_date Undocumented

Inherited from ParamType:

Method __call__ Undocumented
Method fail Helper method to fail with an invalid value message.
Method get_missing_message Optionally might return extra information about a missing parameter.
Method shell_complete Return a list of :class:`~click.shell_completion.CompletionItem` objects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well.
Method split_envvar_value Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.
Class Variable arity Undocumented
Class Variable envvar_list_splitter Undocumented
Class Variable is_composite Undocumented
def __init__(self, formats=None): (source)

Undocumented

Parameters
formats:t.Optional[t.Sequence[str]]Undocumented
def __repr__(self): (source)

Undocumented

Returns
strUndocumented
def convert(self, value, param, ctx): (source)

Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types. The ``param`` and ``ctx`` arguments may be ``None`` in certain situations, such as when converting prompt input. If the value cannot be converted, call :meth:`fail` with a descriptive message. :param value: The value to convert. :param param: The parameter that is using this type to convert its value. May be ``None``. :param ctx: The current context that arrived at this value. May be ``None``.

Parameters
value:t.AnyUndocumented
param:t.Optional[Parameter]Undocumented
ctx:t.Optional[Context]Undocumented
Returns
t.AnyUndocumented
def get_metavar(self, param): (source)

Returns the metavar default for this param if it provides one.

Parameters
param:ParameterUndocumented
Returns
strUndocumented
def to_info_dict(self): (source)

Gather information that could be useful for a tool generating user-facing documentation. Use :meth:`click.Context.to_info_dict` to traverse the entire CLI structure. .. versionadded:: 8.0

Returns
t.Dict[str, t.Any]Undocumented
name: str = (source)

Undocumented

formats = (source)

Undocumented

def _try_to_convert_date(self, value, format): (source)

Undocumented

Parameters
value:t.AnyUndocumented
format:strUndocumented
Returns
t.Optional[datetime]Undocumented