Browse Source

HUE-2647 [solr] Utilize client timezone for date expressions

Romain Rigaux 7 years ago
parent
commit
e42c11d981

+ 1 - 0
desktop/libs/dashboard/src/dashboard/static/dashboard/js/search.ko.js

@@ -146,6 +146,7 @@ var Query = function (vm, query) {
   });
   self.fqs = ko.mapping.fromJS(query.fqs);
   self.start = ko.mapping.fromJS(query.start);
+  self.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
 
   var defaultMultiqGroup = {'id': 'query', 'label': 'query'};
   self.multiqs = ko.computed(function () { // List of widgets supporting multiqs

+ 3 - 0
desktop/libs/libsolr/src/libsolr/api.py

@@ -254,6 +254,9 @@ class SolrApi(object):
       ('hl.fragsize', 1000),
     )
 
+    if query.get('timezone'):
+      params += (('TZ', query.get('timezone')),)
+
     if collection['template']['fieldsSelected']:
       fields = []
       for field in collection['template']['fieldsSelected']: