-
Notifications
You must be signed in to change notification settings - Fork 42
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
Respecting Local Time in Django 1.11 #60
Comments
@sirberus Mhm sounds reasonable. Can you provide a pull request. We don't have any free capacities to work on this app right now. Thanks! |
Having the same issue as Sirberus, the event shows the next day trying the mentioned solution didn't work for me. Any help is appreciated. @sirberus would you be able to share your views.py |
Ended doing the folllowing: Original code changed to since i'm in Est time:
this way, every event is now shown in the right day; however the date in the URL is a day ahead due to UTC storage, I guess using a slug solution would be a good approach. |
I was tweaking calendarium 1.3.4 today to work with my Django 1.11 site and I noticed that, after 5pm PST, it was already saying that "today" was tomorrow. As in, the day for which
current = True
inviews.py
was the next day. Realizing that this was a UTC/timezone issue I began investigating.Though
now()
fromdjango.utils.timezone
will display as local time if printed, the calls tonow().date()
seem to be lose the timezone and revert to UTC. Printnow().time()
for a very blatant example.I discovered that by importing
localtime()
fromdjango.utils.timezone
and wrapping eachnow()
call aslocaltime(now())
this solved the issue. There may be a prettier way but this does work, importing Django'sTIME_ZONE
fromsettings.py
and forcing.date()
and.time()
to remain timezone-aware.The text was updated successfully, but these errors were encountered: