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 calculation error: NSoT should set UTC by default. #327

Open
candlerb opened this issue May 25, 2018 · 1 comment
Open

Timezone calculation error: NSoT should set UTC by default. #327

candlerb opened this issue May 25, 2018 · 1 comment

Comments

@candlerb
Copy link

I am running NSOT in an lxd container which has UTC as its timezone.

When creating or editing anything in the NSOT GUI, the changelog tells me that the change happened "5 hours ago".

I believe this is to do with the Django legacy default TIME_ZONE which is America/Chicago

I suggest that the default generated nsot.conf.py have TIME_ZONE = 'UTC', because this is what Django does for new projects:

Since Django was first released with the TIME_ZONE set to 'America/Chicago', the global setting (used if nothing is defined in your project’s settings.py) remains 'America/Chicago' for backwards compatibility. New project templates default to 'UTC'.

When I change this setting, all the existing changes still say they happened "5 hours ago", but new changes are "a few seconds ago". It appears that dates are stored in local time.

A modern Django project will have USE_TZ=True and maybe that ought to be used as well.

The default settings.py file created by django-admin startproject includes USE_TZ = True for convenience.

This might mean that timestamps are stored in the database as UTC, regardless of the display timezone, which would be better.

@jathanism
Copy link
Contributor

The NSoT GUI needs a lot of work and it's likely a bad bug.

We decided not to set the timezone by default, to leave that up to people to do, but I think you're right, we should just set it ourselves.

@jathanism jathanism changed the title Timezone calculation error Timezone calculation error: NSoT should set UTC by default. Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants