Skip to content

Commit 66ba187

Browse files
authored
Add stammtisch dynamically every 3rd Wed (#15)
* Add stammtisch dynamically every 3rd Wed * Remove Cardlayout
1 parent 11dcc2d commit 66ba187

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

app/impressum/page.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,47 @@ export default function Impressum() {
2121
</a>{' '}
2222
in Berlin. Drop in and say hi!
2323
</p>
24+
<div>
25+
<p>
26+
Next Stammtisch:
27+
{(() => {
28+
const today = new Date()
29+
const currentMonth = today.getMonth()
30+
const currentYear = today.getFullYear()
31+
32+
// Create date object for 1st of current month
33+
let date = new Date(currentYear, currentMonth, 1)
34+
35+
// Find first Wednesday
36+
while (date.getDay() !== 3) {
37+
date.setDate(date.getDate() + 1)
38+
}
39+
40+
// Add 2 weeks to get to 3rd Wednesday
41+
date.setDate(date.getDate() + 14)
42+
43+
// If 3rd Wednesday already passed this month, move to next month
44+
if (date < today) {
45+
date = new Date(currentYear, currentMonth + 1, 1)
46+
while (date.getDay() !== 3) {
47+
date.setDate(date.getDate() + 1)
48+
}
49+
date.setDate(date.getDate() + 14)
50+
}
51+
52+
return (
53+
<span className="font-medium">
54+
{date.toLocaleDateString('en-US', {
55+
weekday: 'long',
56+
year: 'numeric',
57+
month: 'long',
58+
day: 'numeric',
59+
})}
60+
</span>
61+
)
62+
})()}
63+
</p>
64+
</div>
2465
<p>
2566
We are coordinating on Matrix:
2667
<a

0 commit comments

Comments
 (0)