Browse Source

[search] Set the correct date on Datepicker with a Moment.js format

Enrico Berti 10 năm trước cách đây
mục cha
commit
9d8084e3d6

+ 4 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -1311,6 +1311,10 @@ ko.bindingHandlers.datepicker = {
     var _options = ko.unwrap(valueAccessor());
     _el.datepicker({
       format: "yyyy-mm-dd"
+    }).on("show", function (e) {
+      if (_options.momentFormat) {
+        _el.datepicker("setValue", moment(_el.val()).utc().format("YYYY-MM-DD"));
+      }
     }).on("changeDate", function (e) {
       setDate(e.date);
     }).on("hide", function (e) {

+ 1 - 1
desktop/core/src/desktop/templates/common_header.mako

@@ -522,7 +522,7 @@ from django.utils.translation import ugettext as _
                  <li class="divider"></li>
                  % if 'search' in apps:
                  <li><a href="${ url('search:new_search') }" style="height: 24px; line-height: 24px!important;"><i class="fa fa-plus" style="vertical-align: middle"></i> ${ _('Dashboard') }</a></li>
-                 <li><a href="${ url('search:admin_collections') }" style="height: 24px; line-height: 24px!important;"><i class="fa fa-tags" style="vertical-align: middle"></i> ${ _('Dashboards') }</a></li>
+                 <li><a href="${ url('search:admin_collections') }" style="height: 24px; line-height: 24px!important;"><i class="fa fa-tags" style="vertical-align: middle"></i>${ _('Dashboards') }</a></li>
                  % endif
                  % if 'indexer' in apps:
                  <li><a href="${ url('indexer:collections') }" style="height: 24px; line-height: 24px!important;"><i class="fa fa-database" style="vertical-align: middle"></i> ${ _('Indexes') }</a></li>