Skip to content

Mid Suffolk District Council - Date Parsing Error #1904

@aaronchidgey

Description

@aaronchidgey

Name of Council

Mid Suffolk

Issue Information

The Mid Suffolk website is now returning date strings with a leading comma and inconsistent spacing (e.g., , Wed 29 Apr 2026). This causes the strptime logic to fail with ValueError: unconverted data remains.

I have manually patched this by using re.search to extract the date. This ignores the leading comma and any strange spacing. I changed line 124 of uk_bin_collection/uk_bin_collection/councils/MidSuffolkDistrictCouncil.py to the below:

"import re
date_match = re.search(r"(\d{1,2}\s+\w{3}\s+\d{4})", date_str)
if date_match:
collection_date = datetime.strptime(date_match.group(1), "%d %b %Y")`

After this it is now working but will obviously break with the next update unless fixed."

Verification

  • I searched for similar issues at https://github.com/robbrad/UKBinCollectionData/issues?q=is:issue and found no duplicates
  • I have checked my address/postcode/UPRN works on the council's website
  • I have provided a detailed explanation of the issue as well as steps to replicate the issue
  • I understand that this project is run by volunteer contributors therefore completion of this issue cannot be guaranteed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions