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 config question #17

Open
wyyang opened this issue Aug 26, 2014 · 4 comments
Open

Timezone config question #17

wyyang opened this issue Aug 26, 2014 · 4 comments

Comments

@wyyang
Copy link

wyyang commented Aug 26, 2014

Hi,

My server timezone is set at UTC, and my browser is PST. No matter if I set timezone="America/Los_Angeles" or
timezone="Etc/UTC"
in the config.py file, when I tried to add an event via the web interface, it will just add my local PST time to elastic search, unconverted.

Where else shall I look for changes?

Thanks

Weiyi

@Dieterbe
Copy link
Owner

can you open a python2 session on your terminal,
and see how
the local_datepick_to_unix_timestamp function behaves?
i.e. the one at https://github.com/Dieterbe/anthracite/blob/master/anthracite-web.py#L187

looks like somehow python is not aware of your TZ, and assumes you're in UTC or something
you can also add some prints there to see what happens to the data

@wyyang
Copy link
Author

wyyang commented Aug 26, 2014

On the server side the system time is already set at UTC. Appearently it does not do any zone conversion

local_datepick_to_unix_timestamp("01/02/2013 11:22:33 PM")
1357168953
Is exactly 01/02/2013 11:22:33 PM.

How do I fix that? How can I let the server side python know that my desktop browser is at Pacific time, or force it to think all data it receives is Pacific time that needs to be converted to UTC, and do it cleanly instead of hard coding in anthracite-web.py#L187?

@Dieterbe
Copy link
Owner

you should haven't to hardcode anything in anthracite-web.py
it should respect the timezone you have in your config.py
i don't think we do anything with the timezone from the browser (this seems useful to support, although sometimes people have their browser TZ configured badly I think).
I don't have much time nowadays so you might want to do some researching yourself :)

@blalor
Copy link
Contributor

blalor commented Jan 13, 2015

This is a raw event in ES that was created with Anthracite:

{
  "_index": "anthracite",
  "_type": "event",
  "_id": "AUrj3ciFZGZGaKAnf1Gk",
  "_score": null,
  "_source": {
    "date": "2015-01-13T10:15:41",
    "desc": "created 01/13/2015 10:15:41 AM",
    "tags": [
      "anthracite_debug"
    ]
  },
  "sort": [
    1421144141000,
    1421144141000
  ]
}

This is with Anthracite's TZ set to UTC. It's not storing the date in ES with the timezone.

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

3 participants