Skip to content

Commit 8a041cf

Browse files
Date_Fix
1 parent 8b8c39b commit 8a041cf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/utils_date.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ def format_date_for_user(date_str: str, user_locale: Optional[str] = None) -> st
1818
try:
1919
date_obj = datetime.strptime(date_str, "%Y-%m-%d")
2020
locale.setlocale(locale.LC_TIME, user_locale or '')
21-
return date_obj.strftime("%B %d, %Y")
21+
try:
22+
# Use '9 July 2025' format → day first, full month, year
23+
return date_obj.strftime("%-d %B %Y") # Unix/Linux
24+
except ValueError:
25+
return date_obj.strftime("%#d %B %Y") # Windows fallback
2226
except Exception as e:
2327
logging.warning(f"Date formatting failed for '{date_str}': {e}")
2428
return date_str

0 commit comments

Comments
 (0)