Repository: 12rambau/sepal_ui

Issue:
add a today() method for the datepicker
It's something I do a lot, setting up the datepicker to today as: 

```python 

from sepal_ui import sepawidgets as sw 
from datetime import datetime 

dp = sw.Datepicker() 

# do stulff and as a fallback do 
dp.v_model = datetime.today().strftime("%Y-%m-%d")
```

Instead I would love to have something like: 
```python
dp.today()
```

what do you think ? 

Discussion:

Patch:
diff --git a/sepal_ui/sepalwidgets/inputs.py b/sepal_ui/sepalwidgets/inputs.py
index 04e69553..0cb7a9bf 100644
--- a/sepal_ui/sepalwidgets/inputs.py
+++ b/sepal_ui/sepalwidgets/inputs.py
@@ -156,6 +156,12 @@ class DatePicker(v.Layout, SepalWidget):
 
         return
 
+    def today(self) -> Self:
+        """Update the date to the current day."""
+        self.v_model = datetime.today().strftime("%Y-%m-%d")
+
+        return self
+
     @staticmethod
     def is_valid_date(date: str) -> bool:
         """


Test patch:
diff --git a/tests/test_DatePicker.py b/tests/test_DatePicker.py
index 02ee81c1..cfa47475 100644
--- a/tests/test_DatePicker.py
+++ b/tests/test_DatePicker.py
@@ -1,3 +1,5 @@
+from datetime import datetime
+
 import pytest
 from traitlets import Any
 
@@ -96,6 +98,16 @@ class TestDatePicker:
 
         return
 
+    def test_today(self, datepicker) -> None:
+        """check that the date is updated to today"""
+
+        res = datepicker.today()
+
+        assert res == datepicker
+        assert res.v_model == datetime.today().strftime("%Y-%m-%d")
+
+        return
+
     @pytest.fixture
     def datepicker(self):
         """create a default datepicker."""