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

Timezone awareness on first view #60

Open
LlamaSurprise opened this issue Aug 17, 2022 · 1 comment
Open

Timezone awareness on first view #60

LlamaSurprise opened this issue Aug 17, 2022 · 1 comment

Comments

@LlamaSurprise
Copy link

According to the readme:

Django's timezone awareness will not be available on the first page view

Is there a specific reason this library does not attempt this?

Where we're using this library, we're getting a specific issue where when we show the site in an iFrame, it will never show the correct time zone, because of aggressive browser policies against storing cookies.

@ldeluigi
Copy link

A workaround would be to add a new filter for templates that allows javascript to replace every time-zone aware field with the local time-zone equivalent, for the first view.

Or else the middleware could return a javascript redirection page to self that sets the timezone:

  1. The user requests the first page, "index"
  2. The middleware looks in the session if the timezone is present
  3. If it is, the first page is timezone aware
  4. If it's not, it replaces the page with a redirect that initially sets the timezone and then returns the right page but timezone aware

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

No branches or pull requests

2 participants