Skip to content

Commit

Permalink
Add FROM and UNTIL to trigdates
Browse files Browse the repository at this point in the history
Remind needs some information when the SATISFY could evaluate to true or
it will give up with "Can't compute trigger".

Thanks to Dianne Skoll for the proposal.
  • Loading branch information
jspricke committed Jul 7, 2022
1 parent 09c61aa commit eaee837
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion remind.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,15 @@ def stdin_to_vobject(self, lines: str) -> Component:
@staticmethod
def _parse_rdate(rdates: list[date], repeat: int = 1) -> str:
"""Convert from iCal rdate to Remind trigdate syntax."""
rdates = sorted(rdates)
start = rdates[0].strftime("FROM %Y-%m-%d")
trigdates = [
(rdate + timedelta(days=d)).strftime("$T=='%Y-%m-%d'")
for rdate in rdates
for d in range(repeat)
]
return f"SATISFY [{'||'.join(trigdates)}]"
end = (rdates[-1] + timedelta(days=repeat-1)).strftime("UNTIL %Y-%m-%d")
return f"{start} {end} SATISFY [{'||'.join(trigdates)}]"

@staticmethod
def _parse_rruleset(rruleset: Any, duration: timedelta) -> str | list[str]:
Expand Down

0 comments on commit eaee837

Please sign in to comment.