From 090af1edf20edb70667dd8c8b23e7cfa8787bde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dembowski?= Date: Mon, 15 Aug 2022 19:07:36 +0000 Subject: [PATCH] Update events.js + transition week --- locale/_/calendar/events.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/locale/_/calendar/events.js b/locale/_/calendar/events.js index 8c4402849..239305ef6 100644 --- a/locale/_/calendar/events.js +++ b/locale/_/calendar/events.js @@ -332,6 +332,24 @@ module.exports = [ } }, EventLevel.Day), + // last full week (Monday - Friday) in January + new Event('transition_week', 'Transgender', 1, function* (monthDays) { + let lastFullWeek = []; + let currentWeek = []; + for (let d of monthDays) { + if (d.dayOfWeek === 1) { + lastFullWeek = currentWeek; + currentWeek = []; + } + if (d.dayOfWeek >= 1 && d.dayOfWeek <= 5) { + currentWeek.push(d); + } + } + yield* currentWeek.length === 5 + ? currentWeek + : lastFullWeek; + }, EventLevel.Week), + // --- one-off events --- new Event('deaf_awareness_week', 'Progress Pride', 4, function* (monthDays) { for (let d of monthDays) {