Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Problem
Timezone handling in iCalendar is complex, involving:
- VTIMEZONE components
- TZID parameters
- UTC vs local time
- All-day events vs timed events
- Daylight saving time transitions
Current Behavior
Library makes no attempt to handle timezone complexity. Properties are updated as-is.
Challenges
1. VTIMEZONE Components
BEGIN:VCALENDAR
BEGIN:VTIMEZONE
TZID:America/New_York
BEGIN:STANDARD
DTSTART:20231105T020000
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=America/New_York:20250128T140000
END:VEVENT
END:VCALENDAR2. All-day vs Timed Events
DTSTART;VALUE=DATE:20250128 # All-day
DTSTART:20250128T140000Z # UTC
DTSTART;TZID=America/New_York:20250128T140000 # LocalPotential Solutions
- Document only - Users handle timezone in application layer
- Helper functions - Provide utilities for common timezone operations
- Integration - Work with libraries like Luxon/date-fns
Philosophy Alignment
Option 1 aligns best with our minimalist approach. Timezone logic is complex and opinionated, doesn't belong in a "dumb glue" library.
Workaround
Store in UTC
// Application converts to UTC before calling
const utcTime = convertToUTC(userInputTime, userTimezone);
updateFields(event, {
'DTSTART': utcTime // Already in iCal format
});Use ical.js for timezone-aware operations
import ICAL from 'ical.js';
// Parse and handle timezone
const component = new ICAL.Component(ICAL.parse(event.data));
const vevent = component.getFirstSubcomponent('vevent');
// Use ical.js Time with timezone
const time = ICAL.Time.fromJSDate(new Date(), true); // UTC
vevent.updatePropertyWithValue('dtstart', time);
// Update other fields with tsdav-utils
const updated = updateFields(component.toString(), {
'SUMMARY': 'Meeting'
});Best Practice
Recommend in README:
- Store all times in UTC
- Convert to local timezone in UI layer
- Keep timezone logic separate from iCal manipulation
Related
- RFC 5545 Section 3.6.5 (Time Zone Component)
- RFC 5545 Section 3.3.5 (DATE-TIME)
- RFC 5545 Section 3.2.19 (TZID Parameter)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
PhilflowIO commentedon Oct 8, 2026
Status after 0.4.x–0.6.0: most of this issue is done, one part is open.
Done
VALUE=DATEvs date-time, UTC, floating, and an existingTZIDis kept for zoneless input (0.4.x).absoluteTime: 'keep-zone'keeps an existingTZIDwhen a Z/offset value is written (0.6.0).Still open: producing a named zone. The library can keep a
TZIDthat is already there, but cannot introduce one: a new value given asZ/offset is written as UTC, a zoneless one as floating (or host time → UTC). For a new recurring meeting that means a UTC series whose local time shifts by an hour at every DST change. dav-mcp'screate_eventhits exactly this.Proposed scope for this issue:
zone: 'Europe/Berlin'): the value is converted to wall time in that zone (DST gap/fold per RFC 5545 §3.3.5), written withTZID, and a matching VTIMEZONE is added to the VCALENDAR if missing (RFC 5545 §3.6.5 requires one per TZID; check RFC 7809 for omission rules).Consumer side: dav-mcp
create_event/update_eventget a timezone (default from the calendar'scalendar-timezone, see PhilflowIO/dav-mcp#117).[-]Timezone handling complexity[/-][+]Write date-times in a named time zone (TZID + VTIMEZONE)[/+]fix: bound VTIMEZONE cache, put final state last
fix: move ends with a zoned DTSTART, write UTC as Z
feat: export VTIMEZONE, zone and expansion helpers
test: cover the review fixes and consumer helpers
docs: describe review fixes and consumer helpers
test: accept the ICU version's zone abbreviation
fix: stop the VTIMEZONE scan where the zone settles
fix: override ends, elapsed lengths, zone spelling
build: rebuild dist
test: cover far UNTIL, per-kind final state, ends
docs: per-kind final state, timings, override ends