StrToRRule Does Not Apply Timezone to UNTIL and treats it as UTC
Closed this issue · 1 comments
Ferix9288 commented
Basically when it parses a RRULE expression like below where it’s supposed to generate one recurrence on 3/3/2020, it treats the UNTIL as UTC time instead of the specified timezone in the RRULE.
Expression in question:
DTSTART;TZID=America/Los_Angeles:20200225T060000
RRULE:FREQ=WEEKLY;INTERVAL=1;WKST=MO;BYDAY=TU;UNTIL=20200303T063000
Instead of reading UNTIL as LA time 3/3/2020 6:30AM, it reads that as LA time 3/2/2020 10:30PM.
Code-wise, what happens is as follows:
- You call
StrToRRuleSet
. - It correctly trims and parses TZID and overloads
locale
. - However, it then calls below which completely ignores any
locale
and forces UTC.
// StrToROption converts string to ROption
func StrToROption(rfcString string) (*ROption, error) {
return StrToROptionInLocation(rfcString, time.UTC)
}
Ferix9288 commented
Hmm I see. Looks like behavior was intentional based on the specification:
The UNTIL rule part defines a date-time value which bounds the
recurrence rule in an inclusive manner. If the value specified by
UNTIL is synchronized with the specified recurrence, this date or
date-time becomes the last instance of the recurrence. If specified
as a date-time value, then it MUST be specified in an UTC time
format. If not present, and the COUNT rule part is also not present,
the RRULE is considered to repeat forever.
That's confusing >.<''