Repository: mampfes/hacs_waste_collection_schedule

Issue:
[Bug]: calculating "date 2" on Feb.29 ("now.year + 1" = 2025-02-29 does not exist!)
### I Have A Problem With:

The integration in general

### What's Your Problem

The date calculation for synchronizing the calendar has an error in the leap year (02/29).

### Source (if relevant)

_No response_

### Logs

```Shell
Logger: waste_collection_schedule.source_shell
Source: custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py:136
Integration: waste_collection_schedule (documentation)
First occurred: 08:35:09 (1 occurrences)
Last logged: 08:35:09
fetch failed for source Abfall.IO / AbfallPlus: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 134, in fetch entries = self._source.fetch() ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfall_io.py", line 145, in fetch date2 = now.replace(year=now.year + 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: day is out of range for month
```


### Relevant Configuration

_No response_

### Checklist Source Error

- [X] Use the example parameters for your source (often available in the documentation) (don't forget to restart Home Assistant after changing the configuration)
- [X] Checked that the website of your service provider is still working
- [X] Tested my attributes on the service provider website (if possible)
- [X] I have tested with the latest version of the integration (master) (for HACS in the 3 dot menu of the integration click on "Redownload" and choose master as version)

### Checklist Sensor Error

- [X] Checked in the Home Assistant Calendar tab if the event names match the types names (if types argument is used)

### Required

- [ ] I have searched past (closed AND opened) issues to see if this bug has already been reported, and it hasn't been.
- [X] I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.


Discussion:
+1

Stacktrace: 
```
Logger: waste_collection_schedule.source_shell
Source: custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py:136
Integration: waste_collection_schedule ([documentation](https://github.com/mampfes/hacs_waste_collection_schedule#readme))
First occurred: 09:05:39 (1 occurrences)
Last logged: 09:05:39
fetch failed for source ICS: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 134, in fetch entries = self._source.fetch() ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/ics.py", line 179, in fetch return self.fetch_url(self._url, self._params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/ics.py", line 204, in fetch_url return self._convert(r.text) ^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/ics.py", line 215, in _convert dates = self._ics.convert(data) ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 39, in convert end_date = start_date.replace(year=start_date.year + 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: day is out of range for month
```

Results in:
<img width="434" alt="image" src="https://github.com/mampfes/hacs_waste_collection_schedule/assets/4342160/5311d9fa-24d3-423f-8f47-0fd6c5f6a0f4">

duplicate with https://github.com/mampfes/hacs_waste_collection_schedule/issues/1844 

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfall_io.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfall_io.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfall_io.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfall_io.py
@@ -142,7 +142,7 @@ def fetch(self):
         args["f_abfallarten"] = ",".join(map(lambda x: str(x), self._abfallarten))
 
         now = datetime.datetime.now()
-        date2 = now.replace(year=now.year + 1)
+        date2 = now + datetime.timedelta(days=365)
         args["f_zeitraum"] = f"{now.strftime('%Y%m%d')}-{date2.strftime('%Y%m%d')}"
 
         params = {"key": self._key, "modus": MODUS_KEY, "waction": "export_ics"}


Test patch: