Skip to content

Fix: Improve format_date function to handle None and invalid datesImprove error handling in format_date function#412

Open
Harshita-kothari wants to merge 1 commit intohatnote:masterfrom
Harshita-kothari:fix-date-format
Open

Fix: Improve format_date function to handle None and invalid datesImprove error handling in format_date function#412
Harshita-kothari wants to merge 1 commit intohatnote:masterfrom
Harshita-kothari:fix-date-format

Conversation

@Harshita-kothari
Copy link

Summary

This PR improves the format_date function in utils.py to safely handle cases where the date value is None or invalid.

Changes

  • Added a check for None before formatting the date
  • Wrapped date formatting in a try/except block to prevent crashes

Why this change

Previously, the function could raise an exception if the date was None or invalid. This fix ensures the function fails gracefully by returning an empty string.

Testing

  • Tested with None values
  • Tested with valid datetime values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant