1
0

feat(caldav): add support for repeating tasks

Resolves https://github.com/go-vikunja/api/issues/57#issuecomment-1364373103
This commit is contained in:
kolaente
2022-12-24 12:19:51 +01:00
parent ea1d06bda6
commit c5327845ee
4 changed files with 102 additions and 12 deletions

View File

@ -57,10 +57,12 @@ type Todo struct {
RelatedToUID string
Color string
Start time.Time
End time.Time
DueDate time.Time
Duration time.Duration
Start time.Time
End time.Time
DueDate time.Time
Duration time.Duration
RepeatAfter int64
RepeatMode string
Created time.Time
Updated time.Time // last-mod
@ -225,6 +227,16 @@ CREATED:` + makeCalDavTimeFromTimeStamp(t.Created)
PRIORITY:` + strconv.Itoa(mapPriorityToCaldav(t.Priority))
}
if t.RepeatAfter > 0 || t.RepeatMode == "MONTHLY" {
if t.RepeatMode == "MONTHLY" {
caldavtodos += `
RRULE:FREQ=MONTHLY;BYMONTHDAY=` + t.DueDate.Format("02") // Day of the month
} else {
caldavtodos += `
RRULE:FREQ=SECONDLY;INTERVAL=` + strconv.FormatInt(t.RepeatAfter, 10)
}
}
caldavtodos += `
LAST-MODIFIED:` + makeCalDavTimeFromTimeStamp(t.Updated)