Skip to content

Commit

Permalink
Support events in UTC
Browse files Browse the repository at this point in the history
Events in UTC need to have TAG rem2ics_utc.

Thanks to Dianne for the proposal and discussion.
  • Loading branch information
jspricke committed Apr 19, 2024
1 parent 77f6ce4 commit e9ec799
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ Format of the Remind MSG body

The ``%"`` is omitted, if there is no description in the iCalendar.

Support events in UTC
---------------------

Remind always uses the local timezone.
Use something like this to export events in UTC:

::

REM Tue AT [9:00 + $MinsFromUTC] TAG rem2ics_utc MSG Event

Known limitations
-----------------

Expand Down
5 changes: 5 additions & 0 deletions remind.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ def _parse_remind(self, filename: str, lines: str = "") -> dict[str, dict[str, A
dtstart: datetime | date = datetime.strptime(entry["eventstart"], "%Y-%m-%dT%H:%M").replace(
tzinfo=self._localtz
)
if "rem2ics_utc" in entry["tags"]:
utcoffset = datetime(
self._startdate.year, self._startdate.month, self._startdate.day, tzinfo=self._localtz
).utcoffset()
dtstart = (dtstart - utcoffset).replace(tzinfo=ZoneInfo("UTC")) # type: ignore
else:
dtstart = datetime.strptime(entry["date"], "%Y-%m-%d").date()

Expand Down

0 comments on commit e9ec799

Please sign in to comment.