add handling for yearly event rule exporting
This commit is contained in:
parent
3ca94c9635
commit
0779d6fd96
1 changed files with 11 additions and 2 deletions
|
@ -104,8 +104,9 @@ class Parser {
|
|||
val freq = getFreq(repeatInterval)
|
||||
val interval = getInterval(repeatInterval)
|
||||
val repeatLimit = getRepeatLimitString(event)
|
||||
val byMonth = getByMonth(event)
|
||||
val byDay = getByDay(event)
|
||||
return "$FREQ=$freq;$INTERVAL=$interval$repeatLimit$byDay"
|
||||
return "$FREQ=$freq;$INTERVAL=$interval$repeatLimit$byMonth$byDay"
|
||||
}
|
||||
|
||||
private fun getFreq(interval: Int) = when {
|
||||
|
@ -128,12 +129,20 @@ class Parser {
|
|||
else -> ";$UNTIL=${Formatter.getDayCodeFromTS(event.repeatLimit)}"
|
||||
}
|
||||
|
||||
private fun getByMonth(event: Event) = when {
|
||||
event.repeatInterval.isXYearlyRepetition() -> {
|
||||
val start = Formatter.getDateTimeFromTS(event.startTS)
|
||||
";$BYMONTH=${start.monthOfYear}"
|
||||
}
|
||||
else -> ""
|
||||
}
|
||||
|
||||
private fun getByDay(event: Event) = when {
|
||||
event.repeatInterval.isXWeeklyRepetition() -> {
|
||||
val days = getByDayString(event.repeatRule)
|
||||
";$BYDAY=$days"
|
||||
}
|
||||
event.repeatInterval.isXMonthlyRepetition() -> when (event.repeatRule) {
|
||||
event.repeatInterval.isXMonthlyRepetition() || event.repeatInterval.isXYearlyRepetition() -> when (event.repeatRule) {
|
||||
REPEAT_LAST_DAY -> ";$BYMONTHDAY=-1"
|
||||
REPEAT_ORDER_WEEKDAY_USE_LAST, REPEAT_ORDER_WEEKDAY -> {
|
||||
val start = Formatter.getDateTimeFromTS(event.startTS)
|
||||
|
|
Loading…
Reference in a new issue