You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2017/07/18 14:41:00 UTC

svn commit: r1802303 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-calendar.js

Author: hnoeth
Date: Tue Jul 18 14:41:00 2017
New Revision: 1802303

URL: http://svn.apache.org/viewvc?rev=1802303&view=rev
Log:
TOBAGO-1767 tc:date: days in the past should have an specific CSS class
* add 'past' CSS class to days in the past

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-calendar.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-calendar.js?rev=1802303&r1=1802302&r2=1802303&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-calendar.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-calendar.js Tue Jul 18 14:41:00 2017
@@ -120,10 +120,27 @@ Tobago.DateTime.init = function (element
               'left': left + 'px'
             });
           }
+          Tobago.DateTime.addPastClass();
+        });
+        $date.parent().on('dp.update', function () {
+          Tobago.DateTime.addPastClass();
         });
       });
 };
 
+Tobago.DateTime.addPastClass = function () {
+  var today = jQuery(".bootstrap-datetimepicker-widget .datepicker-days td.today.day[data-day]").eq(0);
+  var todayTimestamp = new Date(today.attr('data-day')).getTime();
+
+  jQuery(".bootstrap-datetimepicker-widget .datepicker-days td.day[data-day]").each(function () {
+    var day = jQuery(this);
+    var currentTimestamp = new Date(day.attr('data-day')).getTime();
+    if (currentTimestamp < todayTimestamp) {
+      day.addClass('past');
+    }
+  });
+};
+
 /*
  Get the pattern from the "Java world" (http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
  and convert it to 'moment.js'.