adamspd / django-appointment

A Django app for managing appointment scheduling with ease and flexibility.
Apache License 2.0
87 stars 29 forks source link

let django handle the timezone #164

Closed deronnax closed 3 months ago

deronnax commented 3 months ago

Current time zone handling of django-appointment is incorrect. settings.TIME_ZONE is a fallback from the past for when correct time zone support was not present in Django. Now timezones works perfectly fine and you are not suppose to use the TIME_ZONE. Just use get_current_timezone() and let django handle the current user's timezone for you.

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 95.18%. Comparing base (078d0ca) to head (547d5d7). Report is 7 commits behind head on main.

Files Patch % Lines
appointment/views.py 62.50% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #164 +/- ## ========================================== - Coverage 95.20% 95.18% -0.02% ========================================== Files 49 49 Lines 5751 5732 -19 ========================================== - Hits 5475 5456 -19 Misses 276 276 ``` | [Flag](https://app.codecov.io/gh/adamspd/django-appointment/pull/164/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adams+Pierre+David) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/adamspd/django-appointment/pull/164/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adams+Pierre+David) | `95.18% <75.00%> (-0.02%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adams+Pierre+David#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

deronnax commented 3 months ago

I am fine with the PR. We can merge it if you are fine too.

deronnax commented 3 months ago

And since we don't manually manipulate timezone anymore, we don't use pytz anymore and we can now remove it. I had to edit a commit already committed for the git history to remain clean sorry, you will probably have to do a git pull --rebase. Sorry for the inconvenience, I do this sparingly I promise.

adamspd commented 3 months ago

And since we don't manually manipulate timezone anymore, we don't use pytz anymore and we can now remove it. I had to edit a commit already committed for the git history to remain clean sorry, you will probably have to do a git pull --rebase. Sorry for the inconvenience, I do this sparingly I promise.

Don't worry, git manipulations is part of my daily routine nowadays because of my line of work, learning it the hard way.

adamspd commented 3 months ago

I am fine with the PR. We can merge it if you are fine too.

I'll try to fix the codecov error and then we merge. I'm fine with it too. Wondering if it's not time to do a 3.4.0 release...

deronnax commented 3 months ago

I think it's worth doing a 3.4.0 release: when you change a lot of things, it's good to release often otherwise a release brings too many changes and people never migrate.

adamspd commented 3 months ago

I think it's worth doing a 3.4.0 release: when you change a lot of things, it's good to release often otherwise a release brings too many changes and people never migrate.

It's just this line in init.py file to change. GitHub Actions will take care of the rest and create the release.