Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion flytekit/interaction/click_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import pathlib
import sys
import types
import typing
import typing as t
from typing import cast, get_args
Expand Down Expand Up @@ -559,7 +560,14 @@ def convert(
return value
try:
# If the expected Python type is datetime.date, adjust the value to date
if self._python_type is datetime.date:
is_union = typing.get_origin(self._python_type) in (
typing.Union,
types.UnionType,
)
args = typing.get_args(self._python_type)
is_date_type = (is_union and datetime.date in args) or self._python_type is datetime.date

if is_date_type and isinstance(value, datetime.datetime):
# Click produces datetime, so converting to date to avoid type mismatch error
value = value.date()
# If the input matches the default value in the launch plan, serialization can be skipped.
Expand Down
Loading