diff options
author | Ken Murchison <murch@fastmail.com> | 2021-03-17 11:05:26 -0400 |
---|---|---|
committer | Allen Winter <allen.winter@kdab.com> | 2021-04-11 14:28:41 -0400 |
commit | b3ce3c17058ace5ddabdad49e07c0291e84e2291 (patch) | |
tree | 2a63b9a38f8264bbc20381f610843a02fe9680dd | |
parent | a898974512859cbf661e661bff9f33099a9e3c14 (diff) | |
download | libical-git-b3ce3c17058ace5ddabdad49e07c0291e84e2291.tar.gz |
icaltz-util.c: add support for recurrences that occur on the same day of the month
-rw-r--r-- | src/libical/icaltz-util.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libical/icaltz-util.c b/src/libical/icaltz-util.c index 646c3b8a..1aaabc71 100644 --- a/src/libical/icaltz-util.c +++ b/src/libical/icaltz-util.c @@ -733,8 +733,16 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location) icaltime.minute == zone->time.minute && icaltime.second == zone->time.second) { - if (by_day != zone->recur.by_day[0]) { - // Different BYDAY + if (by_day == zone->recur.by_day[0]) { + // Same week and day - remove BYMONTHDAY + zone->recur.by_month_day[0] = ICAL_RECURRENCE_ARRAY_MAX; + } + else if (icaltime.day == zone->recur.by_month_day[0]) { + // Same monthday - remove BYDAY + zone->recur.by_day[0] = ICAL_RECURRENCE_ARRAY_MAX; + } + else { + // Different BYDAY and BYMONTHDAY terminate = 1; } } @@ -795,6 +803,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location) zone->recur.freq = ICAL_YEARLY_RECURRENCE; zone->recur.by_day[0] = by_day; zone->recur.by_month[0] = icaltime.month; + zone->recur.by_month_day[0] = icaltime.day; zone->rrule_prop = icalproperty_new_rrule(zone->recur); } icalcomponent_add_property(zone->rrule_comp, zone->rrule_prop); |