Repository: mampfes/hacs_waste_collection_schedule

Issue:
[Bug]: day_switch_time does not seem to be working correctly
### I Have A Problem With:

The integration in general

### What's Your Problem

I have day switch time set to `20:00` but the day switches at `01:19`

<img width="228" alt="Screenshot 2024-05-08 at 07 24 31" src="https://github.com/mampfes/hacs_waste_collection_schedule/assets/49797976/c84d1086-1fd8-462a-a206-77ed846838a0">

config:

```
waste_collection_schedule:
  sources:
    - name: maldon_gov_uk
      args:
        uprn: "uprn"
      customize:
        - type: Refuse Collection
        - type: Recycling
  day_switch_time: "20:00"
  fetch_time: 01:00
```


### Source (if relevant)

Maldon District Council / maldon.gov.uk

### Logs

_No response_

### Relevant Configuration

```YAML
waste_collection_schedule:
  sources:
    - name: maldon_gov_uk
      args:
        uprn: "uprn"
      customize:
        - type: Refuse Collection
        - type: Recycling
  day_switch_time: "20:00"
  fetch_time: 01:00
```


### Checklist Source Error

- [ ] 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
- [ ] 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

- [X] 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:
It seems like a similar issue to bristol_gov_uk which was raised in [issue #1173](https://github.com/mampfes/hacs_waste_collection_schedule/issues/1173) and resolved [here](https://github.com/mampfes/hacs_waste_collection_schedule/pull/1176). Unsure how to make these changes to maldon_gov_uk, though.

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/maldon_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/maldon_gov_uk.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/maldon_gov_uk.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/maldon_gov_uk.py
@@ -3,17 +3,17 @@
 
 import requests
 from bs4 import BeautifulSoup
-from waste_collection_schedule import Collection
+from waste_collection_schedule import Collection  # type: ignore[attr-defined]
 
 TITLE = "Maldon District Council"
 
-DESCRIPTION = ("Source for www.maldon.gov.uk services for Maldon, UK")
+DESCRIPTION = "Source for www.maldon.gov.uk services for Maldon, UK"
 
 URL = "https://www.maldon.gov.uk/"
 
 TEST_CASES = {
     "test 1": {"uprn": "200000917928"},
-    "test 2": {"uprn": "100091258454"},
+    "test 2": {"uprn": 100091258454},
 }
 
 API_URL = "https://maldon.suez.co.uk/maldon/ServiceSummary?uprn="
@@ -25,15 +25,15 @@
     "Food": "mdi:food-apple",
 }
 
+
 class Source:
     def __init__(self, uprn: str):
         self._uprn = uprn
 
-    def _extract_future_date(self, text):
+    def _extract_dates(self, text):
         # parse both dates and return the future one
-        dates = re.findall(r'\d{2}/\d{2}/\d{4}', text)
-        dates = [datetime.strptime(date, '%d/%m/%Y').date() for date in dates]
-        return max(dates)
+        dates = re.findall(r"\d{2}/\d{2}/\d{4}", text)
+        return [datetime.strptime(date, "%d/%m/%Y").date() for date in dates]
 
     def fetch(self):
         entries = []
@@ -51,15 +51,19 @@ def fetch(self):
             # check is a collection row
             title = collection.find("h2", {"class": "panel-title"}).text.strip()
 
-            if title == "Other Services" or "You are not currently subscribed" in collection.text:
+            if (
+                title == "Other Services"
+                or "You are not currently subscribed" in collection.text
+            ):
                 continue
 
-            entries.append(
-                Collection(
-                    date=self._extract_future_date(collection.text),
-                    t=title,
-                    icon=ICON_MAP.get(title),
+            for date in self._extract_dates(collection.text):
+                entries.append(
+                    Collection(
+                        date=date,
+                        t=title,
+                        icon=ICON_MAP.get(title),
+                    )
                 )
-            )
 
         return entries


Test patch: