Repository: flet-dev/flet
Issue category: Bug Report

Issue:
Opening DatePicker returns AssertionError
### Duplicate Check

- [X] I have searched the [opened issues](https://github.com/flet-dev/flet/issues) and there are no duplicates

### Describe the bug

When running example from docs, clicking on Pick Date button, which opens DatePicker, returns an error:

Future exception was never retrieved
future: <Future finished exception=AssertionError('last_date must be on or after current_date')>
Traceback (most recent call last):
  File "/Users/inesa/.pyenv/versions/3.12.6/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/page.py", line 948, in wrapper
    handler(*args)
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/playground/date-picker-test.py", line 19, in <lambda>
    on_click=lambda e: page.open(
                       ^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/page.py", line 1429, in open
    self.__offstage.update()
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/control.py", line 324, in update
    self.__page.update(self)
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/page.py", line 723, in update
    r = self.__update(*controls)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/page.py", line 835, in __update
    commands, added_controls, removed_controls = self.__prepare_update(*controls)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/page.py", line 851, in __prepare_update
    control.build_update_commands(
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/control.py", line 498, in build_update_commands
    innerCmds = ctrl._build_add_commands(
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/control.py", line 552, in _build_add_commands
    command = self._build_command(False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/control.py", line 579, in _build_command
    self.before_update()
  File "/Users/inesa/projects/flet-dev/flet/sdk/python/packages/flet/src/flet/core/date_picker.py", line 189, in before_update
    self.__last_date is None

### Code sample

<details open><summary>Code</summary>

```python
import datetime
import flet as ft


def main(page: ft.Page):
    page.horizontal_alignment = ft.CrossAxisAlignment.CENTER

    def handle_change(e):
        page.add(ft.Text(f"Date changed: {e.control.value.strftime('%Y-%m-%d')}"))

    def handle_dismissal(e):
        page.add(ft.Text(f"DatePicker dismissed"))

    page.add(
        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,
                )
            ),
        )
    )


ft.app(main)
```

</details>


### To reproduce

1. Run Code sample
2. Click on "Pick date" button -> see the error in output

### Expected behavior

expected to see the DatePicker

### Screenshots / Videos

<details open>
<summary>Captures</summary>

[Upload media here]

</details>


### Operating System

macOS

### Operating system details

macOs

### Flet version

flet==0.25.0.dev3750

### Regression

Yes, it used to work in a previous Flet version (please specify the version in additional details)

### Suggestions

_No response_

### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Additional details

_No response_


Hints:

Patch:
diff --git a/sdk/python/packages/flet/src/flet/core/date_picker.py b/sdk/python/packages/flet/src/flet/core/date_picker.py
index 4abb8122d..09d735f86 100644
--- a/sdk/python/packages/flet/src/flet/core/date_picker.py
+++ b/sdk/python/packages/flet/src/flet/core/date_picker.py
@@ -173,24 +173,6 @@ def __init__(
     def _get_control_name(self):
         return "datepicker"
 
-    def before_update(self):
-        super().before_update()
-        assert (
-            self.__first_date is None
-            or self.__last_date is None
-            or self.__first_date <= self.__last_date
-        ), "last_date must be on or after first_date"
-        assert (
-            self.__first_date is None
-            or self.__current_date is None
-            or self.__first_date <= self.__current_date
-        ), "current_date must be on or after first_date"
-        assert (
-            self.__last_date is None
-            or self.__current_date is None
-            or self.__last_date >= self.__current_date
-        ), "last_date must be on or after current_date"
-
     @deprecated(
         reason="Use Page.open() method instead.",
         version="0.23.0",


Test patch: