fix(caldav): make sure duration and due date follow rfc5545

Related discussion: https://community.vikunja.io/t/error-with-davx-synchronization/810
This commit is contained in:
kolaente 2022-09-07 15:39:40 +02:00
parent f814dd03eb
commit aaeffe925e
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -181,6 +181,10 @@ SUMMARY:` + t.Summary + getCaldavColor(t.Color)
if t.Start.Unix() > 0 { if t.Start.Unix() > 0 {
caldavtodos += ` caldavtodos += `
DTSTART:` + makeCalDavTimeFromTimeStamp(t.Start) DTSTART:` + makeCalDavTimeFromTimeStamp(t.Start)
if t.Duration != 0 && t.DueDate.Unix() == 0 {
caldavtodos += `
DURATION:PT` + formatDuration(t.Duration)
}
} }
if t.End.Unix() > 0 { if t.End.Unix() > 0 {
caldavtodos += ` caldavtodos += `
@ -217,11 +221,6 @@ DUE:` + makeCalDavTimeFromTimeStamp(t.DueDate)
CREATED:` + makeCalDavTimeFromTimeStamp(t.Created) CREATED:` + makeCalDavTimeFromTimeStamp(t.Created)
} }
if t.Duration != 0 {
caldavtodos += `
DURATION:PT` + formatDuration(t.Duration)
}
if t.Priority != 0 { if t.Priority != 0 {
caldavtodos += ` caldavtodos += `
PRIORITY:` + strconv.Itoa(mapPriorityToCaldav(t.Priority)) PRIORITY:` + strconv.Itoa(mapPriorityToCaldav(t.Priority))