Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Until date string should always be in UTC. #529

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DarryQueen
Copy link
Contributor

In the current behavior, the until date string is in UTC iff the TZID is not specified. According to the RRule spec:

If the "DTSTART" property is specified as a date with UTC time or a date with local time and time zone reference, then the UNTIL rule part MUST be specified as a date with UTC time.

By this spec, the until date string should be in UTC if the converse is true - i.e. TZID is specified. So we should always use UTC for until.

Note that python-dateutil library actually throws an error if TZID is specified for dtstart and until is not in UTC according to StackOverflow.

@DarryQueen
Copy link
Contributor Author

@davidgoli bump.

@TobTobXX
Copy link

I hate to bump threads, but this is a really simple one-line change that fixes a quite annoying bug. See also the discussion here: #486. @jakubroztocil, is there something blocking this?

@truesteps
Copy link

truesteps commented Aug 7, 2023

@jakubroztocil hello! Could you please merge this or is something blocking it? Im having compatibility issues with php-rrule and rrulejs

@gjunge
Copy link

gjunge commented Aug 31, 2023

See also #596

@davidgoli
Copy link
Collaborator

The spec isn't quite that simple:

  The value of the UNTIL rule part MUST have the same
  value type as the "DTSTART" property.  Furthermore, if the
  "DTSTART" property is specified as a date with local time, then
  the UNTIL rule part MUST also be specified as a date with local
  time.  If the "DTSTART" property is specified as a date with UTC
  time or a date with local time and time zone reference, then the
  UNTIL rule part MUST be specified as a date with UTC time.

So if DTSTART is a local time without time zone, then UNTIL must also be in local time, but if DTSTART is either UTC or has a time zone reference then UNTIL is in UTC. (This doesn't seem like correct behavior to me, but I didn't write the spec.)

@truesteps
Copy link

Any updates on the topic? This causes a mismatch for me while parsing rrule output on the backend, for now, as a workaround I just sneak in a Z at the end of the until definition via a regex, which doesn't seem like the most bulletproof solution :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants