fix(caldav): Incoming tasks do not get correct time zone #1455
No reviewers
Labels
No Label
dependencies
duplicate
help wanted
invalid
kind/bug
kind/feature
needs reproduction
question
security
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/vikunja#1455
Loading…
Reference in New Issue
No description provided.
Delete Branch "ce72/api:main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Dates from tasks.org may be formatted like DUE;TZID=Europe/Berlin:20230402T150000
After this fix the parameter TZID is no longer ignored and the Vikunja task gets a DueDate of 13:00 UTC, which corresponds to 15:00 in Europe/Berlin. Before this fix, the time was parsed to 15:00 UTC.
Resolves vikunja/api#1453
@ -218,0 +222,4 @@
if len(tzParameter) > 0 {
loc, err := time.LoadLocation(tzParameter[0])
if err != nil {
log.Warningf("Error while parsing caldav timezone %s: %s", tzParameter[0], err)
I think we should return when an error happens. Or put differently, what should happen when this fails? Should it just continue?
My idea was to be tolerant. If the location string is unknown, we still parse without location in line 236. This will then return the same (invalid) time like the code in main.
Do you really think we should change that?
That explanation makes sense. Fine to leave it like that.
@ -222,0 +276,4 @@
Title: "Vikunja",
},
},
DueDate: time.Date(2023, 4, 2, 15, 0, 1, 0, config.GetTimeZone()),
Shouldn't this be
Europe/Berlin
and `17:00 instead of the configured time zone?How does Vikunja store timezones? I was not sure about this.
In line 231 I convert the parsed time (which in the test is in CEST) to the configured timezone, to be safe. Do you think I should omit this? Can we store times at any timezone?
It stores everything in utc in the database, then lets the users configure their time zone for things like reminders and other emails.
I think it's okay to save it in the configured time zone and then check that here, the parsed time result here might be different if people run the tests with a different time zone configured. That's an edge case though and something we can leave to the people doing that.
Understand. But then I think line 231 should better be
If other times are stored in UTC, I didn't mean to deviate. Maybe you can fix this if you come along. But, as you say, both versions lead to the same result and both pass the test.
f93a2855ed
to300100ad8a
Thanks!