Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(importer): added %Y.%m.%d. + tests for guess_date_format #26200

Closed
wants to merge 1 commit into from

Conversation

vmatt
Copy link
Contributor

@vmatt vmatt commented Apr 29, 2024

Description:

This pull request introduces a minor update to the DATE_FORMATS array in the frappe/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 the frappe/tests/test_utils.py.

Key Changes:

  • Date Format Addition: Included a new date format "%Y.%m.%d." in the DATE_FORMATS array to support the Hungarian date format.
  • Unit Tests: Added test case in TestDateUtils class to verify the guessing logic handles a broad set of date and time formats correctly.

Caveats & Future Directions:

  • The current implementation of 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:

  1. Checkout this branch.
  2. Run the updated unit tests using bench --site [your-site-name] run-tests --module frappe.tests.test_utils.TestDateUtils.
  3. Review the test output and verify that all new tests pass without errors.

Orginal pull req: #25940
Your feedback is welcomed!

@vmatt vmatt requested a review from a team as a code owner April 29, 2024 10:06
@vmatt vmatt requested review from ankush and removed request for a team April 29, 2024 10:06
@vmatt
Copy link
Contributor Author

vmatt commented Apr 30, 2024

hey @ankush, can you please trigger a tett run for the unit tests?

Copy link

stale bot commented May 15, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

@stale stale bot added the inactive label May 15, 2024
@stale stale bot closed this May 18, 2024
@vmatt
Copy link
Contributor Author

vmatt commented May 18, 2024

@ankush ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant