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
DST handling #18
Comments
There's actually an errata regarding the very specific section I quoted, it should actually say:
And that referenced section says:
|
Testing both transitions (jumping forward an jumping backward): package main
import (
"fmt"
"github.com/teambition/rrule-go"
"time"
)
func main() {
rule, err := rrule.NewRRule(rrule.ROption{
Freq: rrule.DAILY,
Dtstart: parse("2023-01-01 02:30:00"),
})
if err != nil {
panic(err)
}
for _, t := range rule.Between(parse("2023-03-25 00:00:00"), parse("2023-03-28 00:00:00"), true) {
fmt.Println(t)
}
fmt.Println()
for _, t := range rule.Between(parse("2023-10-28 00:00:00"), parse("2023-10-31 00:00:00"), true) {
fmt.Println(t)
}
}
func parse(s string) time.Time {
loc, err := time.LoadLocation("Europe/Berlin")
if err != nil {
panic(err)
}
t, err := time.ParseInLocation(time.DateTime, s, loc)
if err != nil {
panic(err)
}
return t
}
First one should be correct based on my understanding. However, the second one should be 2023-10-29 02:30:00 +0200 CEST because that's the first occurrence of 2:30. Also, the library seems to rely on
|
Also, with more frequent repetitions than |
Even though
github.com/teambition/rrule-go
looked like the most promising library for evaluating rrules, it does not handle DST changes correctly.For an event repeating daily at 02:30 in Europe/Berlin it generates a recurrence at 2023-03-26 03:30:00 (there is no 02:30 on that day in that timezone). That's incorrect according to the standard:
Example:
Incorrect output (the second line should not exist):
The text was updated successfully, but these errors were encountered: