-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Feature Description
Summary
When creating a TaskNotes task from an ICS event through the Create Task action in the ICSEventInfoModal, the plugin currently never assigns a due date, even when the ICS event includes a valid end timestamp.
This behaviour is enforced in ICSNoteService.createTaskFromICS():
due: overrides?.due || undefined, // Don't set due date from ICS eventsAs a result:
scheduled:is always set (using the ICS start time)due:is always suppressed- Users cannot change this without modifying plugin source code
This leads to missing deadline metadata for calendar-based tasks, even though ICS events almost always include an end time.
Current Behaviour (Accurate Technical Description)
When a user selects “Create Task” for an ICS event:
-
scheduled:- Always populated from
icsEvent.start - Uses smart logic for all-day vs timed events
- Always populated from
-
due:- Always
undefined - Explicitly prevented from using
icsEvent.end
- Always
-
Task frontmatter therefore never contains:
due:or its user-mapped field (typically
dueDate:)
Why This Is a Problem
User expectations
For many users, the end of a calendar event is the natural deadline—especially when using the ICS import system for:
- appointments
- meetings
- deadlines
- submission windows
- classes
- events with a finite duration
Current behaviour forces users to:
- manually add the due date after creation, or
- rely only on “scheduled”, which does not represent a deadline, or
- rewrite the plugin locally every update
This breaks automation workflows and makes TaskNotes less predictable for calendar-based task generation.
Proposed Solution: Add a Toggle in Settings
Add a user-configurable toggle:
Setting name (developer-friendly)
useICSEndAsDue: boolean
UI label (user-friendly)
“Use ICS event end time as task due date”
Description
When enabled, tasks created from calendar events will have their due date set to the ICS event’s end time.
- Timed events → YYYY-MM-DDTHH:mm
- All-day events → YYYY-MM-DD
- Events without an end → No due date
When disabled, due dates are not imported.
Default value
false
This preserves existing behaviour.
Expected Behaviour Under All Event Types
1. Timed event example
ICS:
DTSTART:20250212T090000
DTEND:20250212T110000
Task created should include:
scheduled: 2025-02-12T09:00
due: 2025-02-12T11:00
2. All-day event
ICS:
DTSTART;VALUE=DATE:20250212
DTEND;VALUE=DATE:20250213 (ICS all-day events end the following day)
The due date should anchor to the actual date of the event, not the ICS container date.
Task:
scheduled: 2025-02-12
due: 2025-02-12
3. Event missing DTEND
No due date is created:
due: undefined
4. If user overrides “due” explicitly
Their override wins:
due: overrides.due
Internal Implementation Details
Minimal required change in ICSNoteService.createTaskFromICS()
Replace current line:
due: overrides?.due || undefined,With conditional logic:
due:
overrides?.due !== undefined
? overrides.due
: (
this.plugin.settings.useICSEndAsDue && icsEvent.end
? this.computeDueFromICSEnd(icsEvent)
: undefined
),Add helper:
private computeDueFromICSEnd(icsEvent: ICSEvent): string | undefined {
try {
const raw = (icsEvent.allDay && /^\d{4}-\d{2}-\d{2}$/.test(icsEvent.end))
? icsEvent.end + 'T00:00:00'
: icsEvent.end;
const d = new Date(raw);
return icsEvent.allDay
? formatDateForStorage(d)
: format(d, "yyyy-MM-dd'T'HH:mm");
} catch {
return icsEvent.end;
}
}Field Mapping Compatibility
Because tasks use the canonical field due and TaskService applies:
this.plugin.fieldMapper.toUserField("due")
This automatically respects user preferences (e.g., dueDate: vs deadline:).
Why a Toggle Is Needed Instead of Changing Default Behaviour
- Many users prefer the existing “scheduled-only” behaviour
- Effects workflows where due dates are intentionally left blank
- Preserves backward compatibility and avoids unexpected metadata changes
- Some use ICS imports only as contextual notes, not deadlines
Adding a toggle provides both behaviours cleanly.
Optional Enhancements (Future Work)
If maintainers want to extend functionality later:
- Allow mapping ICS → Task fields (start → scheduled, end → due, summary → title, location → context)
- Allow custom date rounding (start of hour, end of day, nearest quarter-hour)
- Allow ignoring ICS end times for events under X minutes (e.g., trivial meetings)
Metadata
Metadata
Assignees
Labels
Projects
Status