Skip to content

Extract time and recurrence field builders from DmfsTaskBuilder#365

Merged
sunkup merged 2 commits into
mainfrom
340-4-time-recurrence-builders
May 13, 2026
Merged

Extract time and recurrence field builders from DmfsTaskBuilder#365
sunkup merged 2 commits into
mainfrom
340-4-time-recurrence-builders

Conversation

@sunkup
Copy link
Copy Markdown
Member

@sunkup sunkup commented May 12, 2026

Closes #356. Part of #340.

Extract AllDayBuilder, StartTimeBuilder, DueBuilder, DurationBuilder, and RecurrenceFieldsBuilder from the inline code in DmfsTaskBuilder.buildTask(). AllDayBuilder takes over the timezone resolution logic previously in DmfsTaskBuilder.getTimeZone(), which is now removed. RecurrenceFieldsBuilder delegates to AllDayBuilder to resolve the timezone for RDATE/EXDATE formatting.

Each builder has a corresponding unit test.

Note
The tasks contract has a single TZ column for the whole task and someone has to write Tasks.TZ. Neither StartTimeBuilder (only writes Tasks.DTSTART) nor DueBuilder (only writes Tasks.DUE) set a timezone.

AllDayBuilder is the natural fit because:

  1. IS_ALLDAY and TZ are semantically coupled: an all-day task should have TZ = null; a timed task needs a concrete timezone — the builder already branches on this distinction.
  2. TZ applies globally (to both DTSTART and DUE), so it can't belong to either time-field builder alone.
  3. The getTimeZone() helper resolves the timezone by inspecting both dtStart and due, with a system-default fallback — consistent with the single-TZ-per-task model.

@sunkup sunkup marked this pull request as draft May 12, 2026 12:01
@sunkup sunkup marked this pull request as ready for review May 12, 2026 13:49
@sunkup sunkup self-assigned this May 12, 2026
@sunkup sunkup added the refactoring Quality improvement of existing functions label May 12, 2026
sunkup added 2 commits May 13, 2026 11:21
Extract AllDayBuilder, StartTimeBuilder, DueBuilder, DurationBuilder,
and RecurrenceFieldsBuilder from the inline code in buildTask().
AllDayBuilder takes over the timezone resolution logic previously in
DmfsTaskBuilder.getTimeZone(), which is now removed.
@sunkup sunkup force-pushed the 340-4-time-recurrence-builders branch from 17efffa to b1a3e58 Compare May 13, 2026 09:21
@sunkup sunkup requested a review from rfc2822 May 13, 2026 09:24
@sunkup sunkup merged commit 902b6e0 into main May 13, 2026
9 checks passed
@sunkup sunkup deleted the 340-4-time-recurrence-builders branch May 13, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Quality improvement of existing functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DmfsTask: extract time and recurrence field builders

2 participants