[calendar] fix .ics

This commit is contained in:
Andrea 2022-01-15 17:01:36 +01:00
parent 5fb3d6c30c
commit bde8ce214f
1 changed files with 9 additions and 0 deletions

View File

@ -78,6 +78,12 @@ module.exports.Event = class {
getDays(year) {
year = parseInt(year);
if (this.daysMemoise === undefined) {
// shouldn't happen, but somehow does, but only on prod?
this.daysMemoise = {};
}
if (this.daysMemoise[year] === undefined) {
this.daysMemoise[year] = [...this.generator(iterateMonth(year, this.month))];
}
@ -111,6 +117,9 @@ module.exports.Event = class {
toIcs(year, translations, clearLinkedText, sequence = 1) {
const days = this.getDays(year);
if (!days.length) {
return null;
}
const first = days[0];
const last = days[days.length - 1].next();