-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add time zone support #411
Comments
Oh, I see 267c32b at least fixed the time to be stored UTC internally, but it didn't fix my use case. We still need to consider how the time is displayed in the chart. |
Actually, there is no assumption about the timezone of the data, and the plan was to show the dates/times as they are returned from the database to avoid such issues and let the querying user control the timezone. About a month ago, I started using the But looks like this resulted in two bugs:
I think that the best thing to do, is to revert to previous method of handling this (just print the time as is) and find a way to correctly print the dates without using But just to verify my theory in #2 above, can you check what time zone you have configured on your machine? |
@arikfr, my browser is configured for Pacific Standard Time (UTC-0700), and the database usually uses UTC. |
I agree. I think that we should make as a little assumptions about the data as possible and just show the data as is, regardless of the time zone. Does this sound right to you? |
@arikfr I like the idea, but I'd imagine this may still lead to confusion if a UTC offset or time zone isn't shown somewhere. Also, Moment.js will enforce either UTC or local time zone. Is it really practical to create a timestamp that has no time zone associated with it? |
Maybe there should be a configuration option of default timezone? And we will apply this to timestamps without timezone? (using UTC by default) |
Yes, definitely. |
I was looking into finally fixing this because this is an annoying bug. I think it would be easier to fix this issue if this comment were addressed: // TODO: we should stop manipulating incoming data, and switch to relaying on the column type set by the backend.
// This logic is prone to errors, and better be removed. Kept for now, for backward compatability. That way we can tell if a value is a TIMESTAMP type and parse accordingly. Should we fix this by storing the column type mappings as a field in the |
Oh, it looks like |
1. Load all date/datetime values with moment.utc() which doesn't apply current timezone to them. 2. Don't use toLocaleString to format strings (which was converting them to current timezone as well). Ref #411.
@stanhu see what I did in #617. I think it should address all (most?) of the issues mentioned on this thread. It will be perfect once we add per-user configuration of date/time format & default timezone (I created #618 to track this). If you think it doesn't fully address your issue, please reopen. Thanks! |
1. Load all date/datetime values with moment.utc() which doesn't apply current timezone to them. 2. Don't use toLocaleString to format strings (which was converting them to current timezone as well). Ref getredash#411.
Right now re:dash assumes that all timestamps are in the local time zone. However, Redshift (and many other databases, depending on the configuration) default to UTC, and thus re:dash parses the data incorrectly. What's confusing is that in Highcharts also formats the data in local time, leading to this awkward display:
Notice how the data is highlighted at the beginning of April 23 (which hasn't happened yet in GMT), but the date is showing April 22 4:00 pm (which hasn't happened yet in Pacific Standard Time).
I temporarily worked around this by patching ng_highchart.js:
resources.js:
I'd imagine there will be cases where some users have their database configured to output a specific standard time and others will use UTC. What's the best way to support this feature? Options:
query_result
(so moment will parse the right value)What do you think, @arikfr?
The text was updated successfully, but these errors were encountered: