Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

$__timeFilter does not respect timezone selected in dashboard #165

Closed
jpuerto96 opened this issue Nov 6, 2019 · 2 comments
Closed

$__timeFilter does not respect timezone selected in dashboard #165

jpuerto96 opened this issue Nov 6, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jpuerto96
Copy link

jpuerto96 commented Nov 6, 2019

When attempting to use the raw SQL editor, it appears that the filter does not respect the selected timezone for the dashboard, if the timepicker is using a pre-defined range.

For example, using Last 12 hours, the raw SQL sent through to BigQuery is as follows:
WHERE time BETWEEN '2019-11-06 01:50:03' AND '2019-11-06 13:50:03'

On the other hand, if I use a custom time range for 2019-11-06 00:00:00 to 2019-11-06 23:59:00, the raw SQL sent through to BigQuery is as follows:
WHERE time BETWEEN '2019-11-05 19:00:00' AND '2019-11-06 18:59:00'

The time column in BigQuery is stored in UTC time. The ultimate question here is how can I force the $__timeFilter() to use UTC time.

Edit: The machine's timezone is EST. Therefore, if it is 13:50:03 and UTC is selected, it should set the time to 18:50:03.

@jpuerto96 jpuerto96 changed the title $__timeFilter does not respect timezone selected in Timezone $__timeFilter does not respect timezone selected Nov 6, 2019
@jpuerto96 jpuerto96 changed the title $__timeFilter does not respect timezone selected $__timeFilter does not respect timezone selected in dashboard Nov 6, 2019
@jpuerto96
Copy link
Author

Potential work around for anyone having issues with this, rather than relying on $__timeFilter() use the following where clause to force UTC time in your query:

WHERE TIMESTAMP(time) > TIMESTAMP_MILLIS($__from) AND TIMESTAMP(time) < TIMESTAMP_MILLIS($__to)

@avivl avivl self-assigned this Nov 7, 2019
@avivl avivl added the enhancement New feature or request label Nov 7, 2019
@avivl avivl added this to the 1.0.3 milestone Nov 7, 2019
@avivl
Copy link
Contributor

avivl commented Nov 7, 2019

image

@avivl avivl closed this as completed in bf88c63 Nov 7, 2019
avivl added a commit that referenced this issue Nov 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants