Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the real week nbr #40

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/event_calendar/templates/event_calendar/week_grid.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
<div class="mb-6 mt-8">
<h3 class="text-center text-lg">Vecka 23 (Denna vecka)</h3>
<h3 class="text-center text-lg"><p id="weeknumber"></p></h3>
<hr class="transform scale-x-110">
</div>
<div class="grid grid-cols-3">
{% for event in object_list %}
{% include 'event_calendar/card.html' %}
{% endfor %}
</div>

<script>
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)";
</script>