salopensource / sal

Modular reporting for Endpoints
Apache License 2.0
214 stars 63 forks source link

Timezone stuck on BST #423

Closed Fallout476 closed 2 years ago

Fallout476 commented 3 years ago

Describe the bug using th TZ option in docker does not change the timezone from BST to local or UTC

the timezone is correct on the db

saldb1=# SHOW TIMEZONE; TimeZone

America/Los_Angeles (1 row)

however, this is what is displayed on the front end.

Screen Shot 2021-06-24 at 2 08 58 PM

Expected behavior when using the TZ option, the timezone changes to the timezone we desire.

Server (please complete the following information):

Client (please complete the following information):

Additional context Sal refuses to run nginx in DEBUG MODE

from the log sal-d.REDACTED docker[122675]: /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

grahamgilbert commented 3 years ago

I cannot replicate this. Please share your full docker run command, and if you are mounting in a custom settings.py, please share that as well.

Fallout476 commented 3 years ago

/bin/docker run \ --rm \ --name=sal \ --hostname=sal \ -p 443:443 -p 8000:8000 \ -v /etc/letsencrypt/live/sal./sal.conf:/etc/nginx/sites-enabled/sal.conf \ -v /etc/letsencrypt/live/<sal.:/opt \ -v /opt/docker/salprod/plugins:/home/docker/sal/plugins \ -e DB_HOST= \ -e DB_PORT= \ -e ADMIN_PASS= \ -e DB_NAME= \ -e DB_USER= \ -e DB_PASS= \ macadmins/sal:4.1.9

is the TZ var during the container startup?

grahamgilbert commented 3 years ago

is the TZ var during the container startup?

I don't understand this question.

If you aren't passing in the TZ setting, Django will use the timezone set on the server.

vphan13 commented 3 years ago

That's what we thought too, TZ on the server is America/Los_Angelos, yet the web page shows BST. There is no where in our environment where the TZ is BST, not the docker host, postgres server, or postgres DB itself

[root@sal-d locale]# docker exec sal date Thu Jun 24 12:25:17 PDT 2021

machinas-achim commented 2 years ago

Hello @vphan13

Perhaps you can experiment with these environment variables, they work for us:

  -e TZ="Europe/Madrid" \
  -e DOCKER_SAL_TZ="Europe/Madrid" \