from datetime import datetime, date
from typing import Any


def normalise_date(value: Any, allow_none: bool = True) -> date | None:
    if value is None and allow_none:
        return None
    
    if isinstance(value, datetime):
        return value.date()
    
    if isinstance(value, str):
        try:
            return datetime.strptime(value.strip(), "%d/%m/%Y").date()
        except ValueError as exc:
            raise ValueError(f"Invalid date string: {value!r}") from exc
        
    raise ValueError(f"Unexpected date value: {value!r}")