Problem
Currently, updating datetime properties (DTSTART, DTEND, DUE, etc.) with string values fails because ical.js validates and decorates these properties automatically.
Example
// This throws: "invalid date-time value"
updateFields(event, {
'DTSTART': '20250130T140000Z'
});
Root Cause
ical.js updatePropertyWithValue() attempts to parse datetime strings and validate them, which conflicts with our field-agnostic approach.
Potential Solutions
- Document workaround: Users update datetimes separately using ical.js directly
- Special handling: Detect datetime properties and use ical.js Time objects
- Leave as-is: Keep library truly field-agnostic, datetime is user responsibility
Philosophy Alignment
Option 3 aligns best with "parse anything, write anything" - datetime complexity belongs in application layer, not this utility library.
Workaround
import ICAL from 'ical.js';
// Parse manually
const component = new ICAL.Component(ICAL.parse(event.data));
const vevent = component.getFirstSubcomponent('vevent');
// Update datetime using ical.js
const newStart = ICAL.Time.fromString('20250130T140000Z');
vevent.updatePropertyWithValue('dtstart', newStart);
// Update other fields using tsdav-utils
const updated = updateFields(component.toString(), {
'SUMMARY': 'Updated Title',
'LOCATION': 'New Location'
});
Related
- RFC 5545 Section 3.3.5 (DATE-TIME)
- ical.js Time documentation
Problem
Currently, updating datetime properties (DTSTART, DTEND, DUE, etc.) with string values fails because ical.js validates and decorates these properties automatically.
Example
Root Cause
ical.js
updatePropertyWithValue()attempts to parse datetime strings and validate them, which conflicts with our field-agnostic approach.Potential Solutions
Philosophy Alignment
Option 3 aligns best with "parse anything, write anything" - datetime complexity belongs in application layer, not this utility library.
Workaround
Related