This commit is contained in:
+6
-3
@@ -83,17 +83,20 @@ def occurrences(rule: str, starts: datetime, start: datetime, end: datetime, cut
|
||||
count = int(parts.get("COUNT", 100000))
|
||||
if "UNTIL" in parts:
|
||||
until = datetime.fromisoformat(parts["UNTIL"])
|
||||
until = until.replace(tzinfo=UTC) if until.tzinfo is None else until
|
||||
until = until.replace(tzinfo=UTC) if until.tzinfo is None else until.astimezone(UTC)
|
||||
else:
|
||||
until = end
|
||||
if starts.tzinfo is None:
|
||||
starts = starts.replace(tzinfo=UTC)
|
||||
if until.tzinfo is None:
|
||||
until = until.replace(tzinfo=UTC)
|
||||
if start.tzinfo is None:
|
||||
start = start.replace(tzinfo=UTC)
|
||||
if end.tzinfo is None:
|
||||
end = end.replace(tzinfo=UTC)
|
||||
if cutoff is not None:
|
||||
cutoff = cutoff.replace(tzinfo=UTC) if cutoff.tzinfo is None else cutoff.astimezone(UTC)
|
||||
until = min(until, cutoff)
|
||||
if until.tzinfo is None:
|
||||
until = until.replace(tzinfo=UTC)
|
||||
result = []
|
||||
cursor = starts
|
||||
emitted = 0
|
||||
|
||||
Reference in New Issue
Block a user