Repository: ambari
Updated Branches:
  refs/heads/trunk 06a60dedf -> e3587d555


AMBARI-19469 Log Search: Calendar widget for setting the time range is 
confusing (mgergely)

Change-Id: I1756207960c9e4ed0f7b95a5e03cb45d9d7b7aec


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e3587d55
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e3587d55
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e3587d55

Branch: refs/heads/trunk
Commit: e3587d555e0d6291dd5985c817fd7903ac801fe1
Parents: 06a60de
Author: Miklos Gergely <[email protected]>
Authored: Thu Jan 12 17:59:13 2017 +0100
Committer: Miklos Gergely <[email protected]>
Committed: Thu Jan 12 17:59:13 2017 +0100

----------------------------------------------------------------------
 .../libs/other/daterangepicker/js/daterangepicker.js    | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e3587d55/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/other/daterangepicker/js/daterangepicker.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/other/daterangepicker/js/daterangepicker.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/other/daterangepicker/js/daterangepicker.js
index 04798c6..dc571e8 100644
--- 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/other/daterangepicker/js/daterangepicker.js
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/other/daterangepicker/js/daterangepicker.js
@@ -650,12 +650,9 @@
 
             //populate the calendar with date objects
             var startDay = daysInLastMonth - dayOfWeek + this.locale.firstDay 
+ 1;
-            if (startDay > daysInLastMonth)
+            if (startDay > daysInLastMonth + 1)
                 startDay -= 7;
 
-            if (dayOfWeek == this.locale.firstDay)
-                startDay = daysInLastMonth - 6;
-
             var curDate = moment([lastYear, lastMonth, startDay, 12, minute, 
second]);
 
             var col, row;
@@ -663,6 +660,8 @@
                 if (i > 0 && col % 7 === 0) {
                     col = 0;
                     row++;
+                    if (curDate.month() != month)
+                        break
                 }
                 calendar[row][col] = 
curDate.clone().hour(hour).minute(minute).second(second);
                 curDate.hour(12);
@@ -707,7 +706,7 @@
                 html += '<th></th>';
             }
 
-            var dateHtml = this.locale.monthNames[calendar[1][1].month()] + 
calendar[1][1].format(" YYYY");
+            var dateHtml = this.locale.monthNames[calendar[1][1].month()] + " 
" + calendar[1][1].year();
 
             if (this.showDropdowns) {
                 var currentMonth = calendar[1][1].month();
@@ -774,6 +773,9 @@
             }
 
             for (var row = 0; row < 6; row++) {
+                if (calendar[row].length == 0)
+                    continue
+
                 html += '<tr>';
 
                 // add week number

Reply via email to