jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.
https://jkbrzt.github.io/rrule
Other
3.33k stars 511 forks source link

Until date string should always be in UTC. #529

Open DarryQueen opened 2 years ago

DarryQueen commented 2 years ago

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 commented 2 years ago

@davidgoli bump.

TobTobXX commented 1 year ago

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 commented 1 year ago

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

gjunge commented 1 year ago

See also #596

davidgoli commented 11 months ago

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 commented 9 months ago

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