diff --git a/base/methods.py b/base/methods.py index 9384665e3..9c6ac2a81 100644 --- a/base/methods.py +++ b/base/methods.py @@ -845,3 +845,14 @@ def get_next_month_same_date(date_obj): total_days_in_month = calendar.monthrange(year, month)[1] day = min(day, total_days_in_month) return date(day=day, month=month, year=year) + + +def format_date(date_str): + # List of possible date formats to try + + for format_name, format_string in HORILLA_DATE_FORMATS.items(): + try: + return datetime.strptime(date_str, format_string).strftime("%Y-%m-%d") + except ValueError: + continue + raise ValueError(f"Invalid date format: {date_str}") diff --git a/base/templates/base/action_type/action_type_view.html b/base/templates/base/action_type/action_type_view.html index b6428fed5..015cb6c3a 100644 --- a/base/templates/base/action_type/action_type_view.html +++ b/base/templates/base/action_type/action_type_view.html @@ -40,7 +40,7 @@