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

Convert shift date into correct timezone #1451

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

lukasrad02
Copy link
Contributor

Closes #1450

When debugging above issue, I noticed that the shift dates are saved in UTC on the server. When rendering the update view, the times are converted into the correct time zone, but the date is not.

@coveralls
Copy link

Coverage Status

coverage: 83.906%. remained the same
when pulling 8c36fb8 on lukasrad02:fix/shift-edit-wrong-date
into 9be8059 on ephios-dev:main.

@felixrindt felixrindt merged commit f1dd5c6 into ephios-dev:main Dec 16, 2024
15 checks passed
@@ -183,7 +183,7 @@ def get_shift_form(self):
self.request.POST or None,
instance=self.object,
initial={
"date": self.object.meeting_time.date(),
"date": self.object.meeting_time.astimezone(get_default_timezone()).date(),
Copy link
Contributor

Choose a reason for hiding this comment

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

during my recent timezone fun I noticed there is also a shortcut for those two operations: https://docs.djangoproject.com/en/5.1/ref/utils/#django.utils.timezone.localtime

@lukasrad02 lukasrad02 deleted the fix/shift-edit-wrong-date branch December 16, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editing shifts starting at midnight uses wrong date
4 participants