From 2fb6f2c93da311ac3d20c7dfddf7193df0110939 Mon Sep 17 00:00:00 2001 From: MagdalenaBergqvist Date: Thu, 23 Sep 2021 18:19:58 +0200 Subject: [PATCH 1/2] Added scripts for showing the real week nbr --- src/event_calendar/templates/event_calendar/base.html | 6 ++++++ src/event_calendar/templates/event_calendar/week_grid.html | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/event_calendar/templates/event_calendar/base.html b/src/event_calendar/templates/event_calendar/base.html index a9e37bc..3c855a9 100644 --- a/src/event_calendar/templates/event_calendar/base.html +++ b/src/event_calendar/templates/event_calendar/base.html @@ -2,6 +2,12 @@ + diff --git a/src/event_calendar/templates/event_calendar/week_grid.html b/src/event_calendar/templates/event_calendar/week_grid.html index 126b7a3..6d2dea3 100644 --- a/src/event_calendar/templates/event_calendar/week_grid.html +++ b/src/event_calendar/templates/event_calendar/week_grid.html @@ -1,5 +1,5 @@
-

Vecka 23 (Denna vecka)

+


@@ -7,3 +7,7 @@

Vecka 23 (Denna vecka)

{% include 'event_calendar/card.html' %} {% endfor %}
+ From d5ec7082e66e95d5e85ebe6e6f83b1bb15b2ae29 Mon Sep 17 00:00:00 2001 From: MagdalenaBergqvist Date: Tue, 28 Sep 2021 18:28:51 +0200 Subject: [PATCH 2/2] Moved functionality to week_grid --- src/event_calendar/templates/event_calendar/base.html | 6 ------ .../templates/event_calendar/week_grid.html | 10 +++++++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/event_calendar/templates/event_calendar/base.html b/src/event_calendar/templates/event_calendar/base.html index 3c855a9..a9e37bc 100644 --- a/src/event_calendar/templates/event_calendar/base.html +++ b/src/event_calendar/templates/event_calendar/base.html @@ -2,12 +2,6 @@ - diff --git a/src/event_calendar/templates/event_calendar/week_grid.html b/src/event_calendar/templates/event_calendar/week_grid.html index 6d2dea3..c48c73f 100644 --- a/src/event_calendar/templates/event_calendar/week_grid.html +++ b/src/event_calendar/templates/event_calendar/week_grid.html @@ -7,7 +7,11 @@

{% include 'event_calendar/card.html' %} {% endfor %} + + let now = new Date(); + let onejan = new Date(now.getFullYear(), 0, 1); + let week = Math.ceil((((now.getTime() - onejan.getTime()) / 86400000) + onejan.getDay() + 1) / 7); + var element = document.getElementById("weeknumber") + element.innerHTML = "Vecka " + week + " (Denna vecka)"; +