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
Fixed #33037 -- Fixed Trunc() with offset timezones on MySQL, SQLite, Oracle. #17814
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Thank you for your contribution 💪
As it's your first contribution be sure to check out the patch review checklist.
If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!
If you have any design or process questions then you can ask in the Django forum.
Welcome aboard ⛵️!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
I've included some suggestions that I think would improve the tests a bit.
buildbot, test on oracle. |
@adzshaf Thanks 👍 Please take a look at @LilyFoote's test suggestions. |
Hey @adzshaf! I think you misunderstood what I was suggesting with Something like: truncations = ("year", "quarter", "month", "week", "day", "hour", "minute", "second")
for truncation in truncations:
with subTest(truncation=truncation):
assert_datetime_to_time_kind(truncation)
assert_datetime_kind(truncation) |
@LilyFoote my bad for not confirming it. OK, I understand, but should we also do the same for |
Let's leave the other test as it was for now. It might be worth updating it too in a separate PR/commit later, but lets get the main change ready first. |
It's OK - I realise I wasn't at all clear with what I meant! |
Yes, we don't mix cleanups with bugfixes. |
Co-authored-by: Lily Foote <code@lilyf.org>
b7488e9
to
22285d3
Compare
@adzshaf Thanks 👍 Welcome aboard ⛵ I moved cleanups to a separate commit, made small edits, and used |
@felixxm thanks a lot! Sorry for the inconvenience, haven't got time to fix it yet 🙇 |
Fixed ticket: 33037
Changes:
split_tzname_delta
by adding:00
to offset if the offset does not have minute format.Example, offset that will be passed into this function is
10
, but MySQL and Oracle cannot parse it since it didn't follow correct format, e.g:10:00
.This fix will also fix bug on SQLite. Previously, the tuple unpacking returned error since the offset will be
"10"
and its split result become["10"]
.tzname
become empty fromsplit_tzname_delta
result, so it would be error. Hence, useconn_tzname
for fallback value.I added test which is nearly identical of this part of test, with its difference on which timezone that is used. I think we can extract test functions from these parts.