[calendar] add aids_memorial, health_week, lesbian_visibility_week

This commit is contained in:
Avris 2021-09-15 17:48:08 +02:00
parent 04dedceca3
commit 9c8c9c9e0c
1 changed files with 49 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import {Event, day, week, month, EventLevel} from "../../src/calendar/helpers";
import {Event, Day, day, week, month, EventLevel} from "../../src/calendar/helpers";
export default [
// months
@ -33,15 +33,15 @@ export default [
new Event('nonbinary_parents_day', 'Nonbinary', 4, day(18), EventLevel.MajorDay),
new Event('trans_prisoner', 'Transgender', 1, day(22), EventLevel.MajorDay),
new Event('xenogender_day', 'Xenogender', 5, day(15), EventLevel.MajorDay),
new Event('genderqueer_day', 'Genderqueer', 4, day(25), EventLevel.MajorDay),
new Event('genderfluid_day', 'Genderfluid', 6, day(16), EventLevel.MajorDay),
new Event('aids_day', null, 12, day(1), EventLevel.MajorDay),
new Event('genderqueer_day', 'Genderqueer', 4, day(25), EventLevel.MajorDay),
new Event('genderfluid_day', 'Genderfluid', 6, day(16), EventLevel.MajorDay),
new Event('aids_day', null, 12, day(1), EventLevel.MajorDay),
new Event('tolerance_day', null, 11, day(16), EventLevel.MajorDay),
new Event('social_justice_day', null, 2, day(20), EventLevel.MajorDay),
new Event('stonewall_day', 'Progress Pride', 6, day(28), EventLevel.MajorDay),
new Event('domestic_violence', null, 5, day(25), EventLevel.MajorDay),
new Event('polysexual_day', 'Polysexual', 7, day(26), EventLevel.MajorDay),
new Event('orlando_day', null, 6, day(12), EventLevel.MajorDay),
new Event('social_justice_day', null, 2, day(20), EventLevel.MajorDay),
new Event('stonewall_day', 'Progress Pride', 6, day(28), EventLevel.MajorDay),
new Event('domestic_violence', null, 5, day(25), EventLevel.MajorDay),
new Event('polysexual_day', 'Polysexual', 7, day(26), EventLevel.MajorDay),
new Event('orlando_day', null, 6, day(12), EventLevel.MajorDay),
// dynamic date
new Event('arospec_week', 'Aromantic', 2, week(function* (monthDays) {
@ -137,4 +137,44 @@ export default [
}
}
}, EventLevel.MajorDay),
new Event('aids_memorial', null, 5, function* (monthDays) {
let sundays = 0;
for (let d of monthDays) {
if (d.dayOfWeek === 7) {
sundays++;
if (sundays === 3) {
yield d;
return;
}
}
}
}, EventLevel.MajorDay),
new Event('health_week', null, 3, week(function* (monthDays) {
let prevBuffer = [];
let buffer = [];
for (let d of monthDays) {
if (d.dayOfWeek <= 5) {
buffer.push(d);
}
if (d.dayOfWeek === 5) {
prevBuffer = buffer;
buffer = [];
}
}
yield* prevBuffer;
}), EventLevel.Week),
new Event('lesbian_visibility_week', 'Lesbian', 4, week(function* (monthDays) {
let lastDay = null;
for (let d of monthDays) {
if (d.day >= 26) {
yield d;
}
lastDay = d;
}
yield new Day(lastDay.year, 5, 1);
yield new Day(lastDay.year, 5, 2);
}), EventLevel.Week),
];