Skip to content

Commit

Permalink
Improve timezone handling:
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arikfr committed Oct 20, 2015
1 parent 5a6fe98 commit a01fd91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions handlers/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ def index(**kwargs):
'permissions': current_user.permissions
}

features = {
client_config = {
'clientSideMetrics': settings.CLIENT_SIDE_METRICS,
'allowScriptsInUserInput': settings.ALLOW_SCRIPTS_IN_USER_INPUT,
'highChartsTurboThreshold': settings.HIGHCHARTS_TURBO_THRESHOLD
'highChartsTurboThreshold': settings.HIGHCHARTS_TURBO_THRESHOLD,
'dateFormat': settings.DATE_FORMAT,
'dateTimeFormat': "{0} HH:mm".format(settings.DATE_FORMAT)
}

return render_template("index.html", user=json.dumps(user), name=settings.NAME,
features=json.dumps(features),
client_config=json.dumps(client_config),
analytics=settings.ANALYTICS)


Expand Down
1 change: 1 addition & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def all_settings():
CLIENT_SIDE_METRICS = parse_boolean(os.environ.get("REDASH_CLIENT_SIDE_METRICS", "false"))
# http://api.highcharts.com/highcharts#plotOptions.series.turboThreshold
HIGHCHARTS_TURBO_THRESHOLD = int(os.environ.get("REDASH_HIGHCHARTS_TURBO_THRESHOLD", "1000"))
DATE_FORMAT = os.environ.get("REDASH_DATE_FORMAT", "DD/MM/YY")

# Features:
FEATURE_ALLOW_ALL_TO_EDIT_QUERIES = parse_boolean(os.environ.get("REDASH_FEATURE_ALLOW_ALL_TO_EDIT", "true"))
Expand Down

0 comments on commit a01fd91

Please sign in to comment.