Skip to content

Commit

Permalink
Add stammtisch dynamically every 3rd Wed (#15)
Browse files Browse the repository at this point in the history
* Add stammtisch dynamically every 3rd Wed

* Remove Cardlayout
  • Loading branch information
kuzdogan authored Jan 13, 2025
1 parent 11dcc2d commit 66ba187
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions app/impressum/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,47 @@ export default function Impressum() {
</a>{' '}
in Berlin. Drop in and say hi!
</p>
<div>
<p>
Next Stammtisch:
{(() => {
const today = new Date()
const currentMonth = today.getMonth()
const currentYear = today.getFullYear()

// Create date object for 1st of current month
let date = new Date(currentYear, currentMonth, 1)

// Find first Wednesday
while (date.getDay() !== 3) {
date.setDate(date.getDate() + 1)
}

// Add 2 weeks to get to 3rd Wednesday
date.setDate(date.getDate() + 14)

// If 3rd Wednesday already passed this month, move to next month
if (date < today) {
date = new Date(currentYear, currentMonth + 1, 1)
while (date.getDay() !== 3) {
date.setDate(date.getDate() + 1)
}
date.setDate(date.getDate() + 14)
}

return (
<span className="font-medium">
{date.toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric',
})}
</span>
)
})()}
</p>
</div>
<p>
We are coordinating on Matrix:
<a
Expand Down

0 comments on commit 66ba187

Please sign in to comment.