Join GitHub today
Formatting a recurrence
To convert a recurrence object to a readable and localized string, you can create a
RecurrenceFormat(context, dateFormat): create a recurrence formatter.
context: any context
dateFormat: date format used to format end dates. Can be null at creation but mustn't be when formatting.
format(Recurrence r): format the recurrence
rto a string.
As of v1.3.0, you can convert recurrences to RFC 5545 compliant
RRule string. For example, a weekly recurrence starting on January 1, 2018 and repeating on Sunday, Monday and Friday for 10 events becomes
RRuleFormat.format(Recurrence r): format recurrence
rto a RRule string. This method is static.
This format may be more easily applicable in other apps. In addition, they are many tools and libraries to parse them. However, it cannot be used to save the recurrence object to storage because the library provides no way to parse them any probably won't ever will. A way to save the recurrence would be parcelables or converting it to a byte array, see the wiki page Using the recurrence object for more information.