Skip to content

fix: strip time component in default base template date comparisons#1838

Open
loukandr wants to merge 1 commit intocallumalpass:mainfrom
loukandr:fix/default-views-time-component
Open

fix: strip time component in default base template date comparisons#1838
loukandr wants to merge 1 commit intocallumalpass:mainfrom
loukandr:fix/default-views-time-component

Conversation

@loukandr
Copy link
Copy Markdown

Problem

today() returns midnight in the Bases formula language, so day-level comparisons in tasks-default.base fail for any value with a time component. A task scheduled for today at a non-midnight time (e.g. 15:45) is excluded from the Today view because date(scheduled) == today() evaluates <today> 15:45 == <today> 00:00 → false. The same issue affects >= today() and <= today() + "Nd" checks across several formulas.

Reported in #1124.

Repro

  1. Create a task with scheduled: 2027-01-15T15:45 (use today's date, any non-midnight time).
  2. Open the Today view in tasks-default.base.
  3. Task is missing.

Fix

Add .date() to strip the time component before comparing, matching the isDueToday and isScheduledToday formulas in the same file.

Affected:

  • View filters: Today, This Week
  • Formulas: isDueThisWeek, isThisWeek, dueDateCategory, nextDateCategory, dueDateDisplay

< today() comparisons (Overdue branches) are left as-is, they evaluate correctly without .date().

Tests

Extended tests/unit/templates/defaultBasesFiles.test.ts with positive pins for the affected formulas and negative matchers against the time-naive shapes.

Fixes #1124

Copilot AI review requested due to automatic review settings April 28, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 4.0.0-beta 3 Today's scheduled tasks not showing

1 participant