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: Better Handle arbitrary ISO 8601 strings after celery serializing #2441

Merged
merged 1 commit into from Jan 16, 2023

Conversation

shamoon
Copy link
Member

@shamoon shamoon commented Jan 15, 2023

Proposed change

See linked issue, #2019 did fix this but I think when parsing some iso 8601 strings it will fail e.g. if you pass 2022-01-15 to the API you get 2022-01-15T00:00:00Z which will fail with Invalid isoformat string: '2022-01-15T00:00:00Z'. So dont parse with datetime.fromisoformat use dateutil.parser.isoparse instead.

Fixes #2435

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other (please explain)

Checklist:

  • I have read & agree with the contributing guidelines.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • If applicable, I have checked that all tests pass, see documentation.
  • I have run all pre-commit hooks, see documentation.
  • I have made corresponding changes to the documentation as needed.
  • I have checked my modifications for any breaking changes.

@shamoon shamoon requested a review from a team as a code owner January 15, 2023 23:16
@github-actions github-actions bot added the bug Bug report or a Bug-fix label Jan 15, 2023
@shamoon shamoon linked an issue Jan 15, 2023 that may be closed by this pull request
@shamoon shamoon changed the title Fix: Coerce created to datetime for document string representation Fix: Better Handle arbitrary ISO 8601 strings Jan 15, 2023
@shamoon shamoon changed the title Fix: Better Handle arbitrary ISO 8601 strings Fix: Better Handle arbitrary ISO 8601 strings after celery serializing Jan 15, 2023
@coveralls
Copy link

coveralls commented Jan 15, 2023

Pull Request Test Coverage Report for Build 3925763092

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 92.717%

Totals Coverage Status
Change from base Build 3918958564: -0.02%
Covered Lines: 5423
Relevant Lines: 5849

💛 - Coveralls

@stumpylog
Copy link
Member

stumpylog commented Jan 16, 2023

So the date coming in from the API isn't a valid ISO-8601 format, but merely something close to it?

Edit: I see the DRF DateTimeField could be configured to accept only an ISO format, maybe that's better to reject not formatting dates?

@shamoon
Copy link
Member Author

shamoon commented Jan 16, 2023

Yea I thought about that, thats an option, I dont feel strongly but this see,ed an easy way to make the API a little more flexible. But again, defer to you.

Copy link
Member

@stumpylog stumpylog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little flexibility seems alright.

@shamoon shamoon added this to the Next Release milestone Jan 16, 2023
@shamoon shamoon merged commit 0b53a89 into dev Jan 16, 2023
@shamoon shamoon deleted the fix-2435 branch January 16, 2023 23:50
@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend bug Bug report or a Bug-fix small-change
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[BUG] Parsing error when POSTing document with created date set
3 participants