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

Last login and Test record history time incorrect (wrt server timezone setting) #545

Closed
advhkjw opened this issue Oct 10, 2018 · 3 comments
Closed

Comments

@advhkjw
Copy link

@advhkjw advhkjw commented Oct 10, 2018

Support requests and general questions must be posted to
StackOverflow
and tagged with the kiwi-tcms tag! Issues are for bug reports and
feature request discussions only!

WARNING: do not publically report security issues in the bug tracker!
Ping us via email to coordinate the fix and disclosure of the problem!

HINT: try to reproduce bugs and errors at https://demo.kiwitcms.org!
This is always running the latest version and will automatically submit
traceback and debugging information to us!

Description of problem

When the first time to create user and log into the system, the time is incorrect. Even, I tried to add some record such as new "Builds", "Product", when I accessed "History" tab, the "Date/time" shown a.m time not p.m. time

Version or commit hash (if applicable)

The OS version is Debian 9.5 installed on Google Cloud.

Steps to Reproduce

1.Create new user by command
docker exec -it kiwi_web /Kiwi/manage.py createsuperuser
2.Login the web
3.Access "My Profile"-->"Last login"

Actual results

2018-10-10 09:37:51

Expected results

2018-10-10 17:XX:XX

Additional info (Python traceback, logs, etc.)

By executing

timedatectl status
I got the below result:
Local time: Wed 2018-10-10 18:02:49 HKT
Universal time: Wed 2018-10-10 10:02:49 UTC
RTC time: Wed 2018-10-10 10:02:49
Time zone: Asia/Hong_Kong (HKT, +0800)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: yes

Even I modified the docker-compose.yml and Dockerfile to specific the timezone, this issue still cannot been fixed.

@advhkjw advhkjw changed the title Last login and Test Last login and Test record history time incorrect Oct 10, 2018
@atodorov

This comment has been minimized.

Copy link
Member

@atodorov atodorov commented Oct 10, 2018

TIME_ZONE = 'Etc/UTC' is in settings so you can change it if you want. Or alternatively update your system time to UTC.

Currently we don't save timezone info in the database so either treat all timestamps as local or UTC or experiment and figure out what breaks.

I think (but I'm not sure) when the browser displays timestamps they turn out localized and may even be in the timezone of the browser. Hadn't checked.

@advhkjw

This comment has been minimized.

Copy link
Author

@advhkjw advhkjw commented Oct 11, 2018

I had already modified /tcms/settings/common.py
TIME_ZONE = 'Etc/UTC' to TIME_ZONE = 'Asia/Hong_Kong' but have no change.
Also the system installed on google cloud which cannot change the UTC
I am sure the browser detect the location is also Hong Kong.
I have googled about this seem the problem is this program didn't handle the timezoen by django.utils.timezone

@atodorov atodorov changed the title Last login and Test record history time incorrect Last login and Test record history time incorrect (wrt server timezone setting) Nov 12, 2018
@aspirin420

This comment has been minimized.

Copy link

@aspirin420 aspirin420 commented Apr 4, 2019

image
It is same for me!
I changed the time_zone, but it still the UTC time when i create the test plan! what can i do now?

atodorov added a commit that referenced this issue Nov 25, 2019
by default Kiwi TCMS is configured for UTC time and this is
confusing some users. All timestamps are displayed according to
configured timezone.
atodorov added a commit that referenced this issue Nov 25, 2019
all of these settings can be customized by the administrator
running Kiwi TCMS. The only thing we can't easily do is display
the data in different time zones when hosting an application for
geographically dispersed team. For this reason the previous commit
displays the server time in the navigation bar.
atodorov added a commit that referenced this issue Nov 25, 2019
- datetime.now() isn't very safe for timezone enabled scenarios
  so make use of django.utils.timezone.now() which acts according
  to settings
- add new linter to prevent & discover usage of datetime.now()
- how to configure time zone has already been documented so close
  issue #545 with this commit
atodorov added a commit that referenced this issue Nov 25, 2019
by default Kiwi TCMS is configured for UTC time and this is
confusing some users. All timestamps are displayed according to
configured timezone.
atodorov added a commit that referenced this issue Nov 25, 2019
all of these settings can be customized by the administrator
running Kiwi TCMS. The only thing we can't easily do is display
the data in different time zones when hosting an application for
geographically dispersed team. For this reason the previous commit
displays the server time in the navigation bar.
@atodorov atodorov closed this in d05a7ed Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.