flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.5k stars 449 forks source link

flet-0.25.0.dev3721 error DatePicker value must be of type date, datetime or None #4363

Open jtoror opened 1 week ago

jtoror commented 1 week ago

Duplicate Check

Describe the bug

File "/home/dev/dev_code/linux/flet/gym/.venv/lib/python3.12/site-packages/flet/core/date_picker.py", line 215, in value raise ValueError("value must be of type date, datetime or None") ValueError: value must be of type date, datetime or None

Code sample

Code ```python date_picker = ft.ElevatedButton( "Pick date", icon=ft.icons.CALENDAR_MONTH, on_click=lambda e: page.open( ft.DatePicker( first_date=datetime.datetime(year=2023, month=10, day=1), last_date=datetime.datetime(year=2024, month=10, day=1), on_change=handle_change, on_dismiss=handle_dismissal, ) ), ) ```

To reproduce

go

Expected behavior

No response

Screenshots / Videos

Captures [Upload media here]

Operating System

Linux

Operating system details

Kubuntu 24.04

Flet version

0.25.0.dev3721

Regression

No, it isn't

Suggestions

No response

Logs

Logs ```console Gtk-Message: 19:45:03.192: Failed to load module "colorreload-gtk-module" Gtk-Message: 19:45:03.193: Failed to load module "window-decorations-gtk-module" package:media_kit_libs_linux registered. /home/dev/dev_code/linux/flet/gym/main.py:140: DeprecationWarning: icons enum is deprecated since version 0.25.0 and will be removed in version 0.28.0. Use Icons enum instead. icon=ft.icons.CALENDAR_MONTH, Future exception was never retrieved future: Traceback (most recent call last): File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/dev/dev_code/linux/flet/gym/.venv/lib/python3.12/site-packages/flet/core/page.py", line 948, in wrapper handler(*args) File "/home/dev/dev_code/linux/flet/gym/main.py", line 142, in ft.DatePicker( File "/home/dev/dev_code/linux/flet/gym/.venv/lib/python3.12/site-packages/flet/core/date_picker.py", line 152, in __init__ self.value = value ^^^^^^^^^^ File "/home/dev/dev_code/linux/flet/gym/.venv/lib/python3.12/site-packages/flet/core/date_picker.py", line 215, in value raise ValueError("value must be of type date, datetime or None") ValueError: value must be of type date, datetime or None ```

Additional details

No response