Calendar files
Calendar files (.ics) for bookings and events, added to Google Calendar, Outlook and Apple Calendar in a click.
Version 1.0.0 · 1 function · 2 crates
Functions
What use ical.qwer gives a program, with the types Quillo sees. To take only some, or under other names: use ics_calendar from ical (Quillo 0.6).
ics_calendar(events: list) → stror an errorAn .ics file of events, each a map: title, start and end (ms or "2026-11-20T18:00:00+01:00"), and optional description, location, url and uid (keep it the same to update an event).
Get it
$ quillo install ical # ical.qwer into this folder$ quillo install ical --example # and its example, ical.qweOr with curl:
$ curl -O https://quillolang.org/plugins/files/ical.qwer$ curl -O https://quillolang.org/plugins/files/ical.qweThen, in your program, all of it or only what you call:
main.qwe
use ical.qweruse ics_calendar from ical // Quillo 0.6: only theseIt uses these crates, which cargo fetches the first time the plugin is built:
[dependencies]
icalendar = "0.16"chrono = "0.4"Example
ical.qwe
// "Add to calendar" for a booking.//// quillo run ical.qwe then open http://localhost:8080/booking.icsuse "ical.qwer"route GET /booking.ics = respond(200, ics_calendar([{ title: "Table for two at Quillo Café", start: "2026-11-20T19:00:00+01:00", end: "2026-11-20T21:00:00+01:00", location: "Keizersgracht 1, Amsterdam", uid: "booking-4521@quillo.example",}])?, { "content-type": "text/calendar; charset=utf-8", "content-disposition": "attachment; filename=booking.ics" })$ quillo run ical.qwe$ curl 'localhost:8080/booking.ics'Source
ical.qwer
//! Calendar files (.ics) for events, bookings and reminders: added to Google Calendar, Outlook and Apple Calendar in a click.//! version: 1.0.0//!//! [dependencies]//! icalendar = "0.16"//! chrono = "0.4"use chrono::{DateTime, TimeZone, Utc};use icalendar::{Calendar, Component, Event, EventLike};use serde_json::Value;fn time(v: Option<&Value>, what: &str) -> Result<DateTime<Utc>, String> { match v { Some(Value::Number(n)) => n.as_i64().and_then(|ms| Utc.timestamp_millis_opt(ms).single()).ok_or(format!("`{}` is out of range", what)), Some(Value::String(s)) => DateTime::parse_from_rfc3339(s).map(|d| d.with_timezone(&Utc)).map_err(|e| format!("`{}`: {} ({})", what, e, s)), _ => Err(format!("each event has `{}`: milliseconds since 1970 or an RFC 3339 time", what)), }}/// An .ics file of `events`, each a map: `title`, `start` and `end` (ms or "2026-11-20T18:00:00+01:00"), and optional `description`, `location`, `url` and `uid` (keep it the same to update an event).pub fn ics_calendar(events: Vec<serde_json::Value>) -> Result<String, String> { let mut cal = Calendar::new(); for (i, e) in events.iter().enumerate() { let text = |k: &str| e.get(k).and_then(|v| v.as_str()).map(str::to_string); let mut ev = Event::new(); ev.summary(&text("title").ok_or(format!("event {} has no title", i + 1))?); ev.starts(time(e.get("start"), "start")?); ev.ends(time(e.get("end"), "end")?); if let Some(d) = text("description") { ev.description(&d); } if let Some(l) = text("location") { ev.location(&l); } if let Some(u) = text("url") { ev.add_property("URL", &u); } if let Some(u) = text("uid") { ev.uid(&u); } cal.push(ev.done()); } Ok(cal.done().to_string())}Related
ICS reader
ics_parse.qwer · 1.0.0Read .ics calendar files from Google, Outlook, Apple and booking sites: each event's start, end, summary, location and repeat rule.8 views · 8 downloadsRecurrence rules rrule.qwer · 1.0.0Repeating events from iCalendar RRULEs: the dates between two days in the event's time zone, daylight saving and exceptions included.7 views · 8 downloadsChinese calendar chinese_calendar.qwer · 1.0.0The Chinese lunisolar calendar: a date's lunar year, month and day in Chinese, leap months included, the year's stem and branch, zodiac animal and element, Chinese New Year, lunar dates back to Gregorian, and the 24 solar terms.8 views · 7 downloadsHijri calendar hijri.qwer · 1.0.0Islamic (Hijri) dates: a Gregorian date in Umm al-Qura, civil or observational reckoning, written in English and Arabic; a Hijri date back to the Gregorian; a month's first and last days; and the year's holy days.7 views · 7 downloadsPublic holidays holidays.qwer · 1.0.0Public holidays of 27 countries for any year from 1970 to 2099, computed rather than listed: Easter and its feasts, "the last Monday of May", Japan's equinoxes, with the day each is taken when it falls on a weekend.8 views · 11 downloadsWorld calendars world_calendars.qwer · 1.0.0Dates in the world's other calendars, each way and with month names: Hebrew, Persian, Ethiopian, Coptic, Indian national, Thai Buddhist, Japanese eras (令和8年) and Taiwan's Minguo; and the Jewish holidays of a year.8 views · 6 downloadsThread
Thread 0 posts
On Calendar files: questions, tips, corrections, and code that uses it.
No posts yet. The first one opens the thread.