Timezone support for $humanTime?


#1

Is there any way that we can get the users timezone? Or set redash to use a certain timezone?

The $humanTime is mostly user-friendly but since it doesn’t know about the user’s timezone, it is misleading.

We could adjust the dates in our query, but there are cases where we don’t need to. We’d have to be able to parse the parameter to know whether to adjust or not.

For example, when the user puts in a time like “2 hours ago” everything is fine, we don’t need to adjust anything because mongo stores the date’s in UTC, but if they enter something like “yesterday 5am” we need to adjust it because 5 AM in UTC isn’t their local 5 AM.

Am I missing anything?

I am currently getting a redash development enviornment setup to see about making a PR. Maybe if we could pass in a timezone to line 10 in https://github.com/getredash/redash/blob/master/redash/utils/human_time.py we’d be OK.