# TaskNotes 3.17.0

## Major Features

### Enhanced Recurring Tasks with DTSTART Support

This release introduces improvements to recurring task handling with full DTSTART (start date/time) integration, addressing long-standing challenges in recurring task management and filtering.

**Background and Motivation:**

The previous recurring task system created difficulties for users in filtering and managing task schedules. Users experienced unintuitive behavior where recurring tasks couldn't be treated consistently with regular tasks, making it challenging to see when the next occurrence would appear or to dynamically update task schedules upon completion. This implementation follows RFC 5545 standards to provide a more robust foundation for recurring task behavior.

**Key Improvements:**

- **DTSTART Integration**: All recurring tasks now include proper start dates and times in their recurrence rules, ensuring consistent behavior across timezones and providing a clear anchor point for the recurring pattern
- **Dynamic Date Updates**: The `task.scheduled` field now always shows the next uncompleted occurrence, automatically updating when tasks are completed rather than showing static pattern dates
- **Flexible Next Occurrence Scheduling**: The next scheduled occurrence can now be placed anywhere - before the pattern start date, outside the recurring pattern, or at any custom time, giving users complete control over scheduling
- **Visual Hierarchy**: Pattern instances display with dashed borders while the next scheduled occurrence shows with solid borders, providing clear visual distinction between the recurring pattern and the active next task
- **Independent Time Control**: Pattern instances and next occurrences can have different times (e.g., daily pattern at 9 AM, next occurrence at 2:30 PM), allowing for exceptions without breaking the recurring pattern
- **Dual Drag Behavior**: Dragging pattern instances updates the recurring pattern timing globally, while dragging the next occurrence reschedules only that specific instance
- **Automatic DTSTART Addition**: The system automatically adds DTSTART when completing recurring tasks, editing recurrence rules, or converting tasks to recurring, ensuring backward compatibility while upgrading task definitions
- **Manual Rescheduling Support**: Clear flags indicate when tasks have been manually rescheduled, maintaining transparency about schedule modifications

### Expandable Project Subtasks

A new feature allows users to expand project task cards to view subtasks inline with proper visual hierarchy.

**Features:**

- **Chevron Controls**: Click chevron icons on project task cards to expand/collapse subtask display
- **Configurable**: New "Show expandable subtasks" setting allows users to enable/disable the feature

### Responsive Pomodoro View

The Pomodoro view now adapts seamlessly to different container sizes with comprehensive responsive design.

Thanks to @oliverlalan for requesting this improvement (#339).

### Enhanced Filename Templates

Significant expansion of available template variables for task creation, providing much greater flexibility in filename patterns.

**New Template Variables:**

- **Date/Time Variations**: shortDate, monthName, dayName, week, quarter, time12, time24
- **Unix Timestamps**: unix (seconds), unixMs (milliseconds) 
- **Title Case Variations**: titleLower, titleUpper, titleSnake, titleKebab, titleCamel, titlePascal
- **Short Forms**: priorityShort, statusShort for single-letter representations
- **Unique Identifiers**: zettel (Zettelkasten ID), nano (high-precision unique ID)

The settings UI now documents all 40+ available template variables for easy reference.

Thanks to @fastrick for the original unix timestamp request.

## Bug Fixes

### Critical Timezone Handling Fixes

This release resolves multiple timezone-related bugs that affected users worldwide, particularly those in non-UTC timezones. These fixes implement the "UTC Anchor" principle for consistent date handling.

**Major Timezone Bugs Fixed:**

- **Recurring Task Completion**: Fixed critical issue where marking recurring tasks complete would affect the wrong day for users in certain timezones, addressing reports from multiple users including issues #327, #322, and #314
- **Calendar Date Misalignment**: Resolved off-by-one day errors in calendar rendering and task indicators, addressing inconsistencies across different views (originally reported by @Crunchnuggetz in issue #129, with additional reports from @donjjones and @robmikulec)
- **Weekly Task Display**: Fixed issue where weekly recurring tasks set for specific days (e.g., Tuesdays) were showing completion dates on the wrong day (Monday) - reported by @jpmoo in issue #322
- **Task Completion Date Bug**: Resolved bug where `complete_instances` was being set to the previous day, causing tasks to remain visible in Agenda view until manually corrected - reported in issue #314
- **Date Parsing Inconsistencies**: Eliminated mixing of UTC and local date parsing that caused timezone-dependent behavior across the application
- **Filter Date Handling**: Fixed date filtering to work consistently across all timezones
- **Agenda View "Today" Detection**: Corrected timezone-sensitive today detection that affected agenda headers
- **ICS Import Timezone Issues**: Resolved timezone problems with both recurring and single events from ICS imports

**Technical Implementation:**

- Introduced `parseDateToUTC()` function for consistent UTC anchoring of date-only strings
- Updated date comparison functions to use UTC anchors throughout
- Replaced timezone-sensitive date operations with consistent UTC-based alternatives
- Comprehensive audit and fix of all date handling patterns in the codebase

### Project Filtering Improvements

Resolved critical bugs in project filtering that prevented proper task display and project selection.

**Fixes:**
- **Wikilink Resolution**: Fixed handling of relative vs absolute project wikilinks (e.g., `[[../Projects/My Project]]` vs `[[My Project]]`) - thanks to @xorander00 for the detailed bug report
- **Filter Grouping Logic**: Corrected AND/OR grouping in project filters to prevent showing too many tasks
- **Missing Projects**: Fixed issue where not all projects appeared in filter dropdown selection
- **Cache Management**: Improved cache invalidation and project name extraction with better validation

### Subtask Widget Improvements

Fixed several issues with the project subtasks widget affecting user experience and reliability.

**Widget Fixes:**

- **View State Persistence**: Fixed issue where subtask widget views would reset when switching between notes or modifying subtasks (reported by @Poly-0000 in issue #329)
- **Filter State Isolation**: Prevented filter settings from bleeding between different notes' subtask widgets
- **Configurable Positioning**: Added setting to control widget placement at top or bottom of notes (requested by @michelebugio in issue #164)
- **Event Listener Management**: Improved cleanup to prevent memory leaks and event accumulation
- **Event Bubbling**: Fixed issue where clicking subtasks would trigger both subtask and parent task modals
- **Styling Isolation**: Prevented completion styles from affecting nested subtasks incorrectly

### ICS Calendar Integration

**Timezone Processing**: Fixed timezone handling bug in ICS calendar subscriptions where VTIMEZONE components weren't being registered before parsing events, causing incorrect display times for timezone-specific calendar events.

### Performance and Reliability

**Cache Optimization**: Restored FilterService cache TTL to 30 seconds after temporary reduction, balancing performance with data freshness.

**Type Safety**: Added proper type assertions for ICAL.TimezoneService calls to resolve TypeScript compilation issues.

**Error Handling**: Enhanced error handling and null safety checks throughout project filtering and service initialization.

## Technical Improvements

### UTC Anchor Implementation

Comprehensive implementation of the UTC Anchor principle for robust timezone handling:

- All date-only strings now consistently parsed as UTC anchors
- Date comparison operations standardized using UTC methods
- Eliminated timezone-dependent date creation patterns
- Added comprehensive timezone test coverage

### Service Architecture

**Expanded Projects Service**: Enhanced state management and tracking for expandable project subtasks with proper cleanup and memory management.

**View State Manager**: Improved view state persistence across different contexts and note switches.

### Documentation Updates

- Updated recurring tasks documentation to reflect new behavior
- Added timezone handling guides for developers
- Enhanced calendar views documentation with drag behavior explanations
- Comprehensive template variable documentation

## Breaking Changes

**Date Handling**: While maintaining backward compatibility for user data, the internal date handling now consistently uses the UTC Anchor principle.

## Migration Notes

Existing recurring tasks will continue to work without modification. The system automatically adds DTSTART components when users interact with recurring tasks (completing, editing, or rescheduling).

