Skip to content

Commit

Permalink
fix: changed rrule translation in PageHeaderEventDates (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrina-bongiovanni authored Aug 14, 2024
1 parent 4b21bbe commit 9e91e08
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,27 @@ const PageHeaderEventDates = ({ content, moment, rrule }) => {

if (content['@type'] === 'Event') {
if (content.recurrence) {
const isRecurrenceByDay = content.recurrence.includes('BYDAY=+');
const isWeekdaySunday = content.recurrence
.split('BYDAY')[1]
?.includes('SU');
const rruleSet = rrulestr(content.recurrence, {
compatible: true, //If set to True, the parser will operate in RFC-compatible mode. Right now it means that unfold will be turned on, and if a DTSTART is found, it will be considered the first recurrence instance, as documented in the RFC.
forceset: true,
});
const RRULE_LANGUAGE = rrulei18n(intl, Moment);
eventRecurrenceText = rruleSet.rrules()[0]?.toText(
(t) => {
if (Moment.locale(intl.locale) === 'it' && isRecurrenceByDay) {
RRULE_LANGUAGE.strings.th = '°';
RRULE_LANGUAGE.strings.nd = '°';
RRULE_LANGUAGE.strings.rd = '°';
RRULE_LANGUAGE.strings.st = '°';

if (isWeekdaySunday) {
RRULE_LANGUAGE.strings['on the'] = 'la';
}
}
return RRULE_LANGUAGE.strings[t];
},
RRULE_LANGUAGE,
Expand Down

0 comments on commit 9e91e08

Please sign in to comment.