No permetre navegar a dies futurs

El 'table-parser' cada dia parseja a la nit els esdeveniments del dia
següent, així que si algú intenta veure les classes d'un dia futur,
trobarà que no hi ha cap classe afegida.

Al no permetre navegar a dies futurs, evitem que alguna persona pensi
que no surten les classes futures degut a un error.
diff --git a/js/build_page.js b/js/build_page.js
index 76ded35..aedfbdb 100644
--- a/js/build_page.js
+++ b/js/build_page.js
@@ -202,6 +202,13 @@
     document.getElementById("time-selector").value = formatTime(date) + " - " + formatTime(end_time);

 }

 

+function isDateAfterTomorrow(potential_time) {

+  var now = new Date();

+  var tomorrow = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);

+

+  return (potential_time >= tomorrow);

+}

+

 function addDateEventListeners(date) {

     document.getElementById("date-prev").addEventListener('click', function (el) {

         current_time = new Date(current_time.getTime() - 24*60*60000);

@@ -209,7 +216,11 @@
         fetchClasses();

     });

     document.getElementById("date-next").addEventListener('click', function (el) {

-        current_time = new Date(current_time.getTime() + 24*60*60000);

+        var potential_time = new Date(current_time.getTime() + 24*60*60000);

+

+        if (isDateAfterTomorrow(potential_time)) return;

+        current_time = potential_time;

+

         buildTimeSelector(current_time);

         fetchClasses();

     });

@@ -224,12 +235,16 @@
         fetchClasses();

     });

     document.getElementById("time-next").addEventListener('click', function (el) {

-        current_time = new Date(current_time.getTime() + 30*60000);

-        if (current_time.getHours() >= MAX_HOUR) {

-            current_time = new Date(current_time.getTime() + 24*60*60000);

-            current_time.setHours(MIN_HOUR);

-            current_time.setMinutes(0);

+        var potential_time = new Date(current_time.getTime() + 30*60000);

+        if (potential_time.getHours() >= MAX_HOUR) {

+            potential_time = new Date(potential_time.getTime() + 24*60*60000);

+            potential_time.setHours(MIN_HOUR);

+            potential_time.setMinutes(0);

         }

+

+        if (isDateAfterTomorrow(potential_time)) return;

+        current_time = potential_time;

+

         buildTimeSelector(current_time);

         fetchClasses();

     });