mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-18 18:05:36 +00:00
fix(calendar): fix recurrent event last date
Fix a bug introduces by #8766b7c
This commit is contained in:
@@ -93,11 +93,13 @@
|
||||
if (until)
|
||||
{
|
||||
lastStartDate = until;
|
||||
lastEndDate = until;
|
||||
}
|
||||
else
|
||||
{
|
||||
repeatCount = [rrule repeatCount];
|
||||
if (dayMask == nil)
|
||||
{
|
||||
// If there's no day mask, we can compute the date of the last
|
||||
// occurrence of the recurrent rule.
|
||||
lastStartDate = [firStart dateByAddingYears: 0 months: 0
|
||||
@@ -106,6 +108,7 @@
|
||||
lastEndDate = [firEnd dateByAddingYears: 0 months: 0
|
||||
days: (interval
|
||||
* (repeatCount - 1))];
|
||||
}
|
||||
}
|
||||
|
||||
if (lastStartDate != nil && lastEndDate != nil)
|
||||
|
||||
@@ -230,10 +230,11 @@ static inline unsigned iCalDoWForNSDoW (int dow)
|
||||
else
|
||||
{
|
||||
untilStart = [rrule untilDate];
|
||||
untilEnd = [rrule untilDate];
|
||||
}
|
||||
}
|
||||
|
||||
if (untilStart != nil)
|
||||
if (untilStart != nil && untilEnd != nil)
|
||||
{
|
||||
if ([untilEnd compare: rStart] == NSOrderedAscending)
|
||||
// Range starts after last occurrence
|
||||
|
||||
@@ -102,11 +102,15 @@
|
||||
lastEndDate = nil;
|
||||
until = [rrule untilDate];
|
||||
if (until)
|
||||
{
|
||||
lastStartDate = until;
|
||||
lastEndDate = until;
|
||||
}
|
||||
else
|
||||
{
|
||||
repeatCount = [rrule repeatCount];
|
||||
if (dayMask == nil)
|
||||
{
|
||||
// When there's no BYxxx mask, we can find the date of the last
|
||||
// occurrence.
|
||||
lastStartDate = [firStart dateByAddingYears: 0 months: 0
|
||||
@@ -115,6 +119,7 @@
|
||||
lastEndDate = [firEnd dateByAddingYears: 0 months: 0
|
||||
days: (interval
|
||||
* (repeatCount - 1) * 7)];
|
||||
}
|
||||
}
|
||||
|
||||
if (lastStartDate != nil && lastEndDate != nil)
|
||||
|
||||
@@ -80,10 +80,12 @@
|
||||
if (until)
|
||||
{
|
||||
lastStartDate = until;
|
||||
lastEndDate = until;
|
||||
}
|
||||
if (repeatCount > 0)
|
||||
{
|
||||
if (lastStartDate == nil && ![rrule hasByMask])
|
||||
{
|
||||
// When there's no BYxxx mask, we can find the date of the last
|
||||
// occurrence.
|
||||
lastStartDate = [firStart dateByAddingYears: (interval * (repeatCount - 1))
|
||||
@@ -92,6 +94,7 @@
|
||||
lastEndDate = [firEnd dateByAddingYears: (interval * (repeatCount - 1))
|
||||
months: 0
|
||||
days: 0];
|
||||
}
|
||||
referenceDate = firStart;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user