title: Implementing rrule using UTC
body: <p>BLUF: Having trouble implementing rrule in web app using UTC datetime variables since <strong>byweekday</strong> does not translate well between time zones. For example, when using byweekday attributes on rrules where local time zone datetime falls on a <strong>day</strong> that is not the same as the UTC equivalent of that day (because of UTC offset), the rrule &quot;breaks&quot; or cannot be easily shifted according to the time zone offset (i.e., the shift of day is not handled automatically).</p>
  <p>Advice: Given multiple sites in multiple time zones accessed remotely, would it be reasonable to use local time internally according to time zone of the site and <strong>not</strong> use UTC internally?</p>
  <p>TLDR:
  I have an application that is deployed to multiple sites each in a different time zone. The application is accessed via a web app that performs user I/O according to the time zone of the site (site's local time). I am currently maintaining all datetime data internally using UTC. My recurrence rules are implemented using rrule.js (<a href="https://github.com/jakubroztocil/rrule" rel="nofollow noreferrer">https://github.com/jakubroztocil/rrule</a>) on the client side, and dateutil.rrule (<a href="http://labix.org/python-dateutil" rel="nofollow noreferrer">http://labix.org/python-dateutil</a>) on the server side.</p>
  <p>When I have an rrule that uses a byweekday setting, the UTC offset from local to UTC is calculated correctly, but the byweekday setting is no longer correct (the byweekday day is not shifted). For example, the following rrule is supposed to be run at 11:55PM local time each Sunday (night).</p>
  <p>DTSTART:20210411T065500Z
  RRULE:FREQ=WEEKLY;UNTIL=20220101T080000Z;INTERVAL=1;WKST=MO;BYDAY=SU</p>
  <p>UTC time is correct given a local time zone offset of -07:00 (=23:55 local time, the night before). But, the rrule set is &quot;wrong&quot; as the first occurrence is given as:</p>
  <p>Sun,    11  Apr     2021    06:55:00    GMT</p>
  <p>So that when the rrule DTSTART is shifted back to the local time zone (-07:00 offset), the rule runs or triggers the day before which is a Saturday. The rule runs at the right time but on the wrong day because the time zone hour shift is correct, but the day shift does not happen. I would rather not have to do the day shifting manually. Seems easier to just implement the internal datetimes in the target time zone. Maybe I've missed a nuance in rrule management?</p>