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

Fix date range selector does not show data of last day when user timezone is not UTC #653

Merged
merged 2 commits into from Nov 18, 2015

Conversation

hakobera
Copy link
Contributor

Related to #594 and #617.
In following conditions, re:dash does not show the data of last day.

  • some timestamp value group by day
  • user in non UTC timezone

Like this:

SELECT
  to_char(created_at, 'YYYY-MM-DD') as day,
  COUNT(*) AS cnt
FROM
  queries
GROUP BY
  day
ORDER BY
  day

I think this is caused dateRange is treated as local timezone, but point.x is treated as UTC.
Following screenshot is a result of console.log(dateRange, point.x); before https://github.com/EverythingMe/redash/blob/master/rd_ui/app/scripts/services/resources.js#L197

2015-11-14 13 07 52

This pull request fix this issue, but I'm not sure that this change is OK for timezone handling in re:dash.
@arikfr What do you think?

@arikfr
Copy link
Member

arikfr commented Nov 15, 2015

Are you sure it's due to time zone differences and not because of the time value of the max value? It looks like your fix actually does that: moves the the hour to be of end of day.

What you did looks ok to me, but I will make sure that we indeed create all time values in the same time zone as you mentioned.

Thanks.

@hakobera
Copy link
Contributor Author

@arikfr Thanks for review. I realized that this is not a issue of the time value of the max value, it's only related timezone difference issue. So I change my code to treat dateRange as UTC, it is as same as point.x.

It shows time as JST (because I live in Japan), and both object's _isUTC is true
2015-11-17 11 04 46

Is this OK for you?

arikfr added a commit that referenced this pull request Nov 18, 2015
Fix date range selector does not show data of last day when user timezone is not UTC
@arikfr arikfr merged commit 1bdc1be into getredash:master Nov 18, 2015
@arikfr
Copy link
Member

arikfr commented Nov 18, 2015

Merged. Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants