diff --git a/hakken-dates.js b/hakken-dates.js new file mode 100644 index 0000000..ad2515a --- /dev/null +++ b/hakken-dates.js @@ -0,0 +1,107 @@ +const skippedMonths = [ + { m: 8, y: 2022 }, + { m: 12, y: 2022 }, +]; + +const i18n = { + en: { + comingDates: 'The following dates are scheduled:', + friday: 'friday', + sunday: 'sunday', + until: 'until', + months: [ + 'Jan.', + 'Feb.', + 'Mar.', + 'Apr.', + 'May', + 'Jun.', + 'Jul.', + 'Aug.', + 'Sep.', + 'Oct.', + 'Nov.', + 'Dec.', + ], + }, + de: { + comingDates: 'Folgende Termine stehen an:', + friday: 'Freitag', + sunday: 'Sonntag', + until: 'bis', + months: [ + 'Jan.', + 'Feb.', + 'Mär.', + 'Apr.', + 'Mai', + 'Jun.', + 'Jul.', + 'Aug.', + 'Sep.', + 'Okt.', + 'Nov.', + 'Dez.', + ], + }, +}; + +const datesLists = { + en: document.getElementById('dates-list-en'), + de: document.getElementById('dates-list-de'), +}; + +const day = 24 * 60 * 60 * 1000; +const week = 7 * day; +const endOfWeekend = 2 * day; +const start = new Date(); +const hakkens = []; +// We'll be looking about half a year into the future +for (let i = 0; i < 185; i++) { + const dateToTry = new Date(start.valueOf() + (i * day)); + if (dateToTry.getDay() !== 5) { + continue; + } + + const oneWeekLater = new Date(dateToTry.valueOf() + week); + if (dateToTry.getMonth() === oneWeekLater.getMonth()) { + continue; + } + + const m = dateToTry.getMonth() + 1; + const y = dateToTry.getFullYear(); + if (skippedMonths.find((s) => s.m === m && s.y === y)) { + continue; + } + hakkens.push(dateToTry); +} + +// Helper function to add leading zeros to dates +const d = (num) => ('0' + num).slice(-2); + +const writeText = (lang) => { + const p = document.createElement('p'); + p.innerHTML = i18n[lang].comingDates; + datesLists[lang].appendChild(p); +} + +const writeDateList = (lang) => { + const ul = document.createElement('ul'); + hakkens.forEach(hakken => { + hakkend = new Date(hakken.valueOf() + endOfWeekend); + const showFirstMonth = hakken.getMonth() !== hakkend.getMonth(); + const li = document.createElement('li'); + li.innerHTML = ` + ${i18n[lang].friday} ${d(hakken.getDate())}. ${showFirstMonth ? i18n[lang].months[hakken.getMonth()] : ''} + ${i18n[lang].until} + ${d(hakkend.getDate())}. ${i18n[lang].months[hakkend.getMonth()]} + `; + ul.appendChild(li); + }); + datesLists[lang].appendChild(ul); +} + +writeText('de'); +writeText('en'); +writeDateList('de'); +writeDateList('en'); diff --git a/hakken.html b/hakken.html index 524b548..8ff77a7 100644 --- a/hakken.html +++ b/hakken.html @@ -21,18 +21,19 @@

English version below

hakken.irl

Du bist eingeladen!

-

Wir treffen uns regelmäßig in Köln zum hakken.irl, ein kleiner 3-Tägiger (Freitag bis Sonntag) Hackathon bei dem es nur darum geht Spaß zu haben und ab zu nerden.

+

Wir treffen uns monatlich in Köln zum hakken.irl, ein kleiner 3-Tägiger (Freitag bis Sonntag) Hackathon bei dem es nur darum geht Spaß zu haben und ab zu nerden.

Was machen wir denn so?

-

Es gibt kein festes Programm. Tendenziell hakken wir an pub.solar relatierten sachen wie z.B. PubSolarOS oder unsere Infra.

+

Es gibt nur einen festen Programmpunkt: bei der Critical Mass mitradeln. Tendenziell hakken wir danach an pub.solar relatierten sachen wie z.B. PubSolarOS oder unsere Infra.

Was wir bisher so gemacht haben:

@@ -41,11 +42,9 @@

Es geht schon ziemlich nerdy zu, und du solltest auf jeden Fall deinen Laptop dabei haben. Allerdings ist es uns eigentlich egal, wie du deine Zeit vertreibst. Im besten Falle kannst du dich auch allein an einem eigenen Projekt vergnügen. Wir benutzen den Raum zum gemeinsamen Arbeiten und Austauschen, aber wenn der vibe passt kannst du dich auch dazu setzen und nur Zocken.

Und wann soll das sein?

-

Folgende Termine stehen an:

+

hakken.irl startet immer am letzten Freitag des Monats.

-

+

Was kostet das?

Es kostet nichts, aber wenn wir mal Essen bestellen oder beim Kiosk was holen wärs cool wenn du was rein gibst. Auch ist ne kleine Spende an den Verein immer gerne gesehen.

@@ -63,15 +62,16 @@

We regularly meet in Cologne to attend hakken.irl, a small 3-day (Friday till Sunday) Hackathon that's just about having fun and nerding around.

What will we be doing?

-

There is no set schedule. In general, we'll be hakking on pub.solar related stuff like PubSolarOS or our infra.

+

There is only one set agenda point: riding with Critical Mass. In general, we'll be hakking on pub.solar related stuff like PubSolarOS or our infra.

Stuff we've done so far:

@@ -80,11 +80,9 @@

It's pretty nerdy over all, and you should definitely bring your laptop. However we don't really care what you do while you're with us. It's good if you can also entertain yourself with a project. We use the space to work together and connect, but if we vibe you can also just sit with us and play games all day.

When will this happen?

-

The following dates are scheduled:

+

hakken.irl always starts on the last friday of the month.

-

+

What do I have to pay?

It's free, but if we order food or get some stuff at a kiosk it'd be cool if you chip in. A small donation to the association is also always welcome.

@@ -97,5 +95,6 @@ +