diff --git a/aleksis/apps/chronos/static/js/chronos/date_select.js b/aleksis/apps/chronos/static/js/chronos/date_select.js
index 7f3e5c3c8346a6d01bb8ed0a10c262348b5fed48..b32309b3e3f4307463dd0b947f94af6cde0356a1 100644
--- a/aleksis/apps/chronos/static/js/chronos/date_select.js
+++ b/aleksis/apps/chronos/static/js/chronos/date_select.js
@@ -1,24 +1,19 @@
-function updateDatepicker() {
-    if (!displayDateOnly) {
-        $("#date").val(formatDate(activeDate));
-    }
-}
+var data = getJSONScript("datepicker_data");
+var activeDate = new Date(data.date);
 
-function update() {
-    console.log("Render new.");
-
-    updateDatepicker();
+function updateDatepicker() {
+    $("#date").val(formatDate(activeDate));
 }
 
 function loadNew() {
-    window.location.href = dest + formatDateForDjango(activeDate);
+    window.location.href = data.dest + formatDateForDjango(activeDate);
 }
 
 function onDateChanged() {
     var str = $("#date").val();
     var split = str.split(".");
     activeDate = new Date(split[2], split[1] - 1, split[0]);
-    update();
+    updateDatepicker();
     loadNew();
 }
 
@@ -26,5 +21,5 @@ function onDateChanged() {
 $(document).ready(function () {
     $("#date").change(onDateChanged);
 
-    update();
+    updateDatepicker();
 });
diff --git a/aleksis/apps/chronos/static/js/chronos/week_select.js b/aleksis/apps/chronos/static/js/chronos/week_select.js
index 98db085cf031142fd47f8c308e3fa11344b1ed9e..3d683a886a909d5996c8038267c177e81c545797 100644
--- a/aleksis/apps/chronos/static/js/chronos/week_select.js
+++ b/aleksis/apps/chronos/static/js/chronos/week_select.js
@@ -1,9 +1,11 @@
+var data = getJSONScript("week_select");
+
 function goToCalendarWeek(cw, year) {
-    window.location.href = dest + year + "/" + cw;
+    window.location.href = data.dest + year + "/" + cw;
 }
 
 function onCalendarWeekChanged(where) {
-    goToCalendarWeek($(where).val(), year);
+    goToCalendarWeek($(where).val(), data.year);
 }
 
 $(document).ready(function () {
diff --git a/aleksis/apps/chronos/templates/chronos/my_timetable.html b/aleksis/apps/chronos/templates/chronos/my_timetable.html
index 70d73c22d52330ec6fbf23c1b401cab2941ffc4b..d50a194d885c0f5f43e3f3697ca8514b42a6757c 100644
--- a/aleksis/apps/chronos/templates/chronos/my_timetable.html
+++ b/aleksis/apps/chronos/templates/chronos/my_timetable.html
@@ -27,10 +27,6 @@
     </div>
   </div>
 
-  <script type="text/javascript">
-    var dest = Urls.myTimetable();
-  </script>
-
   <div class="row">
     <div class="timetable-plan col s12 m12 xl4">
 
diff --git a/aleksis/apps/chronos/templates/chronos/partials/datepicker.html b/aleksis/apps/chronos/templates/chronos/partials/datepicker.html
index 796f9c9b3afebf933fba4a8a51a9add643d17003..ede1fb06e37da69590468018bec6ca5384bd459f 100644
--- a/aleksis/apps/chronos/templates/chronos/partials/datepicker.html
+++ b/aleksis/apps/chronos/templates/chronos/partials/datepicker.html
@@ -1,19 +1,17 @@
-{% load date_js static %}
-
-<script type="text/javascript" src="{% static "js/helper.js" %}"></script>
-<script type="text/javascript">
-  var activeDate = new Date({{ day|date_unix }});
-  var displayDateOnly = {% if display_date_only %}true{% else %}false{% endif %};
-</script>
-<script type="text/javascript" src="{% static "js/chronos/date_select.js" %}"></script>
+{% load static %}
 
+{% if not display_date_only %}
+  <script type="text/javascript" src="{% static "js/helper.js" %}"></script>
+  {{ datepicker|json_script:"datepicker_data" }}
+  <script type="text/javascript" src="{% static "js/chronos/date_select.js" %}"></script>
+{% endif %}
 
 <div class="col s2 no-padding">
     <a class="waves-effect waves-teal btn-flat btn-flat-medium left" href="{{ url_prev }}">
         <i class="material-icons center">navigate_before</i>
     </a>
-
 </div>
+
 {% if display_date_only %}
     <div class="col s8">
     <span class="card-title center-block" id="date">
diff --git a/aleksis/apps/chronos/templates/chronos/substitutions.html b/aleksis/apps/chronos/templates/chronos/substitutions.html
index 52708d1f38673e4b09ad719a7276ff6989ca5028..99b85fad70ce567266e25fa484ae3c174032940c 100644
--- a/aleksis/apps/chronos/templates/chronos/substitutions.html
+++ b/aleksis/apps/chronos/templates/chronos/substitutions.html
@@ -9,10 +9,6 @@
 {% block no_page_title %}{% endblock %}
 
 {% block content %}
-  <script type="text/javascript">
-    var dest = Urls.substitutions();
-  </script>
-
   <div class="row no-margin">
     <div class="col s10 m6 no-padding">
       <h4>{% trans "Substitutions" %}</h4>
diff --git a/aleksis/apps/chronos/templates/chronos/timetable.html b/aleksis/apps/chronos/templates/chronos/timetable.html
index 879e882224a85466bc9045463cc61ebba303ac1a..fa8d482963c934a50c31caecf6716a8b2c1142a5 100644
--- a/aleksis/apps/chronos/templates/chronos/timetable.html
+++ b/aleksis/apps/chronos/templates/chronos/timetable.html
@@ -7,14 +7,10 @@
 {% endblock %}
 
 {% block content %}
+
   {% if smart %}
-    <script type="text/javascript">
-      var week = {{ week.week }};
-      var year = {{ week.year }};
-      var type = "{{ type }}";
-      var pk = {{ pk }};
-      var dest = Urls.timetable(type, pk);
-    </script>
+    <script type="text/javascript" src="{% static "js/helper.js" %}"></script>
+    {{ week_select|json_script:"week_select" }}
     <script type="text/javascript" src="{% static "js/chronos/week_select.js" %}"></script>
   {% endif %}
 
diff --git a/aleksis/apps/chronos/templatetags/date_js.py b/aleksis/apps/chronos/templatetags/date_js.py
deleted file mode 100644
index 4492f75acdb693d991477713a8093b01e7a3d24e..0000000000000000000000000000000000000000
--- a/aleksis/apps/chronos/templatetags/date_js.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from datetime import datetime, time
-
-from django import template
-
-
-register = template.Library()
-
-
-@register.filter
-def date_unix(value: datetime):
-    value = datetime.combine(value, time(hour=0, minute=0))
-    return int(value.timestamp()) * 1000
diff --git a/aleksis/apps/chronos/util/js.py b/aleksis/apps/chronos/util/js.py
new file mode 100644
index 0000000000000000000000000000000000000000..eb9082b0e46bcb06090ae853561d5c86c159ce56
--- /dev/null
+++ b/aleksis/apps/chronos/util/js.py
@@ -0,0 +1,8 @@
+from datetime import datetime, time, date
+
+
+def date_unix(value: date) -> int:
+    """ Converts a date object to an UNIX timestamp """
+
+    value = datetime.combine(value, time(hour=0, minute=0))
+    return int(value.timestamp()) * 1000
diff --git a/aleksis/apps/chronos/views.py b/aleksis/apps/chronos/views.py
index 2e30f6a4e47c91b3a0652144e73b16ddffc76812..8b2d659c2277b9871615d211daed01d4059274db 100644
--- a/aleksis/apps/chronos/views.py
+++ b/aleksis/apps/chronos/views.py
@@ -17,6 +17,7 @@ from aleksis.core.util import messages
 from .forms import LessonSubstitutionForm
 from .models import LessonPeriod, LessonSubstitution, TimePeriod, Room
 from .tables import LessonsTable
+from .util.js import date_unix
 from .util.min_max import (
     period_min,
     period_max,
@@ -183,6 +184,10 @@ def timetable(
     context["pk"] = pk
     context["el"] = el
     context["smart"] = is_smart
+    context["week_select"] = {
+        "year": wanted_week.year,
+        "dest": reverse("timetable", args=[type_, pk])
+    }
 
     week_prev = wanted_week - 1
     week_next = wanted_week + 1
@@ -306,6 +311,10 @@ def substitutions(
 
     context["substitutions"] = substitutions
     context["day"] = wanted_day
+    context["datepicker"] = {
+        "date": date_unix(wanted_day),
+        "dest": reverse("substitutions")
+    }
 
     context["url_prev"], context["url_next"] = get_prev_next_by_day(
         wanted_day, "substitutions_by_date"