fix(importer): added %Y.%m.%d.
+ tests for guess_date_format
#26200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This pull request introduces a minor update to the
DATE_FORMATS
array in thefrappe/utils/data.py
by adding a new date format"%Y.%m.%d."
to cater to the specific needs observed in Hungarian date formatting, where dates end with a period (e.g.,2024.04.04.
).Additionally, I have expanded the unit testing for the
guess_date_format
. This is reflected in changes to thefrappe/tests/test_utils.py
.Key Changes:
"%Y.%m.%d."
in theDATE_FORMATS
array to support the Hungarian date format.TestDateUtils
class to verify the guessing logic handles a broad set of date and time formats correctly.Caveats & Future Directions:
guess_date_format
might still encounter ambiguities with certain date formats (e.g.,23-04-24
can be parsed in multiple ways). A proposed future enhancement is to allow users to specify the date format explicitly during data import, thus minimizing errors and improving data integrity.How to test:
Ensure you have set up your development environment correctly and follow these steps:
bench --site [your-site-name] run-tests --module frappe.tests.test_utils.TestDateUtils
.Orginal pull req: #25940
Your feedback is welcomed!