Skip to content

Commit e2c2dd3

Browse files
authored
Add skipped dates functionality for Stammtisch events (#39)
* Add skipped dates functionality for Stammtisch events Introduced a new data file to manage skipped Stammtisch dates, specifically for June 2025 due to ProtocolBerg v2. Updated the NextStammtisch component to check against this list and skip the specified dates accordingly. * Fix tag
1 parent a96bb03 commit e2c2dd3

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

app/NextStammtisch.tsx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
'use client'
22

3+
import skippedDates from '@/data/skippedStammtisch'
4+
35
export default function NextStammtisch() {
6+
// For testing
7+
// const currentDate = new Date('2025-06-02T12:00:00Z')
48
const currentDate = new Date()
59
const currentMonth = currentDate.getUTCMonth()
610
const currentYear = currentDate.getUTCFullYear()
711
let nextStammtisch = new Date()
812
let nextMonth = 0
913

14+
let shouldSkip = false
15+
1016
do {
1117
// Create date object for 1st of current month
1218
nextStammtisch = new Date(Date.UTC(currentYear, currentMonth + nextMonth, 1))
@@ -22,16 +28,30 @@ export default function NextStammtisch() {
2228
// Set start time to 21:00 UTC which is intentially a bit into the event
2329
nextStammtisch.setUTCHours(21)
2430

25-
// Check if this is June 2025 because of ProtocolBerg v2 (month 5, since January is 0)
26-
if (nextStammtisch.getUTCFullYear() === 2025 && nextStammtisch.getUTCMonth() === 5) {
27-
// Skip June 2025
28-
nextMonth++
31+
// Check if this month is in the skipped dates list
32+
shouldSkip = skippedDates.skippedDates.some(
33+
(skipped) =>
34+
skipped.year === nextStammtisch.getUTCFullYear() &&
35+
skipped.month === nextStammtisch.getUTCMonth()
36+
)
37+
38+
console.log(
39+
`shouldSkip: ${shouldSkip}, date: ${nextStammtisch.toLocaleDateString('en-US', {
40+
weekday: 'long',
41+
year: 'numeric',
42+
month: 'long',
43+
day: 'numeric',
44+
})}`
45+
)
46+
47+
if (shouldSkip) {
48+
++nextMonth
2949
continue
3050
}
3151

3252
// If Stammtisch already started/passed this month, move to next month
33-
nextMonth++
34-
} while (nextStammtisch < currentDate)
53+
++nextMonth
54+
} while (nextStammtisch < currentDate || shouldSkip)
3555

3656
return (
3757
<span className="font-medium">

data/blog/2024/1-what.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 1) What
33
date: 2024-03-26T16:06:04.000Z
44
lastmod: 2024-07-04T12:57:33.000Z
5-
tags: ['ETHBerlin', '04, 'hackathon']
5+
tags: ['ETHBerlin', '04', 'hackathon']
66
authors: ['Franzi', 'Helena']
77
images: ['/static/images/2024/banner-3.png']
88
---

data/skippedStammtisch.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Skipped Stammtisch dates
2+
// Months are 0-indexed (0 = January, 11 = December)
3+
const skippedStammtisch = {
4+
skippedDates: [
5+
{
6+
year: 2025,
7+
month: 5, // June
8+
reason: 'ProtocolBerg v2',
9+
},
10+
],
11+
}
12+
13+
export default skippedStammtisch

0 commit comments

Comments
 (0)