- Notifications
You must be signed in to change notification settings - Fork625
refactor: updateall_day
detection logic#2601
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
ewdurbin merged 5 commits intopython:mainfrommiketheman:miketheman/fix-naive-date-to-datetimeSep 30, 2024
Merged
refactor: updateall_day
detection logic#2601
ewdurbin merged 5 commits intopython:mainfrommiketheman:miketheman/fix-naive-date-to-datetimeSep 30, 2024
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Instead of using a particular resolution on an object, which differsbetween `datetime.date` and `datetime.datetime` objects, operate onparent class of `datetime` and convert all `dt` to timezone-aware`datetime` values.This is also in accordance to the model field being a `DateTimeField`,so we should always be passing the correctly-created object, instead ofa `datetime.date()`, raising `received a naive datetime` warnings.Removes unused constants.Signed-off-by: Mike Fiedler <miketheman@gmail.com>
JacobCoffee approved these changesSep 25, 2024
ewdurbin approved these changesSep 30, 2024
00b4302
intopython:main 3 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
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
Instead of using a particular resolution on an object, which differs between
datetime.date
anddatetime.datetime
objects, operate on parent class ofdatetime
and convert alldt
to timezone-awaredatetime
values.This is also in accordance to the model field being a
DateTimeField
, so we should always be passing the correctly-created object, instead of adatetime.date()
, raisingreceived a naive datetime
warnings.Removes unused constants.
Closes
Closes#2415
Other notes, for fun.
The warnings stem from this little bitty function:
pythondotorg/events/utils.py
Lines 23 to 26 in8a02c10
Since the ICS importer is often met with a string that looks like a date-only, like this one:
pythondotorg/events/tests/test_importer.py
Line 39 in8a02c10
the returned type is
datetime.date
, not adatetime.datetime
.The change in
events/utils.py
drops the warnings, but fails two test cases:These come from the
all_day
calculation over here:pythondotorg/events/importer.py
Lines 33 to 37 in74e659c
which has now been updated.