renovate[bot] 9d043ec4a5 Update dependency org.jetbrains.kotlinx:kotlinx-io-core to v0.9.1 (#14)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-06-26 21:50:59 +00:00
2026-05-21 14:35:43 +02:00
2026-01-31 12:22:03 +01:00
2026-01-31 12:22:03 +01:00
2026-01-31 12:22:03 +01:00
2026-02-03 22:38:22 +01:00
2026-01-31 12:22:03 +01:00
2026-01-31 12:22:03 +01:00
2026-02-02 23:28:36 +01:00

Kotlin iCalendar

Build Status GitHub License GitHub Tag

A standalone library that allows parsing and writing of iCalendar (.ics) files.

This library parses iCalendar files into its own strongly-typed data structures and can render those structures back into RFC-compliant iCalendar output.

Usage

This library is intended to be embedded into other Kotlin projects. It does not provide a standalone CLI or tool for processing .ics files.

In addition to parsing existing iCalendar files, the library provides a Kotlin DSL for creating iCalendar data from scratch.

Creating an event using the DSL

import net.alphadev.icalendar.model.dsl.vCalendar
import net.alphadev.icalendar.model.dsl.EventStatus
import net.alphadev.icalendar.model.dsl.Transparency
import kotlinx.datetime.LocalDateTime
import kotlin.time.Duration.Companion.minutes

val calendar = vCalendar {
    prodId("-//Example Corp//Calendar App//EN")
    calScale("GREGORIAN")

    event {
        summary("Team Sync Meeting")
        description("Weekly team sync to discuss progress and blockers")
        location("Conference Room A")
        status(EventStatus.CONFIRMED)
        transp(Transparency.OPAQUE)

        dtStart(LocalDateTime(2026, 2, 10, 10, 0))
        dtEnd(LocalDateTime(2026, 2, 10, 11, 0))

        organizer("alice@example.com", name = "Alice Example")

        alarm {
            displayAction()
            triggerBefore(15.minutes)
            description("Meeting starts in 15 minutes")
        }
    }
}

The resulting VCalendar instance can then be serialized into a valid iCalendar (.ics) file using the librarys writer.

RFC Compliance

The library strives for compliance with the iCalendar specification (RFC 5545) and related extensions. The codebase is covered by a growing unit test suite (170+ tests at the time of writing).

Real-world calendar files are often imperfect or rely on undocumented or proprietary extensions. To support interoperability, the library deliberately retains unknown components and properties during parsing, allowing vendor-specific data (for example X-* properties or non-standard components) to round-trip without loss.

As such:

  • Valid but uncommon constructs may not yet be fully understood, but are preserved
  • Unknown or proprietary extensions are retained and re-emitted
  • Some invalid files may parse successfully, others may not
  • Output should be RFC-compliant, but compatibility bugs are still possible

Bugs and Issues

If you encounter a (somewhat valid) iCalendar file that this library fails to process — or produces incorrect output for — please dont hesitate to file an issue.

Including a minimal .ics example is greatly appreciated.

S
Description
No description provided
Readme Apache-2.0 327 KiB
Languages
Kotlin 99.8%
Jinja 0.2%