feat: show time-remaining countdown on dated upcoming tasks #238
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nidde/parenting-tool!238
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "copilot/add-countdown-to-task-dates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Dated tasks in the Dashboard "Tasks & Chores" upcoming section now display a compact time-until string alongside the date, e.g.
(May 22, 4m2w1d).Description
Adds a
formatTimeUntilcomposable function and wires it into the task chip date display. Only future dates get the countdown; today/overdue silently omit it.useDate.ts— newformatTimeUntil(dateString):string | Date | null | undefined; returns''for falsy, past, or same-day inputsDateinstances are used as-isDate.UTC) to avoid ±1 day errors around daylight-saving transitions4m2w1d,2w3d,5d, etc.TaskChip.vue— compact chip and card views both updated:taskTimeUntilcomputed property evaluatesformatTimeUntil(props.task.due_date)once per render, avoiding duplicate parsing in both the chip and card view template locationsType of Change
Testing
Code Quality
CI/CD Checks
Additional Notes
Month approximation uses a fixed 30-day bucket (consistent with a compact display — not calendar-accurate). If calendar-accurate month boundaries are needed in future,
formatTimeUntilis self-contained and easy to swap.Comment
@coderabbitai helpto get the list of available commands and usage tips.Pull request overview
Adds a compact “time remaining” countdown to upcoming dated tasks in the Dashboard by introducing a shared date utility and wiring it into the task date label.
Changes:
formatTimeUntil()to theuseDatecomposable to compute a compactXmYwZdstring for future dates.TaskChip.vueto append the time-until string alongside formatted due dates in both chip and card views.DEVLOG.mdandCHANGELOG.md.Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
formatTimeUntil()used to compute the compact countdown string.@ -8,7 +8,12 @@ Use `[1.CURRENT]` as the version heading for unreleased changes. This section muThe DEVLOG describes the output as
\"Xm Yw Zd\"(with spaces), but the implementation returns a concatenated string without spaces (e.g.,4m2w1d). Please update the description to match the actual output format to avoid confusion for future readers.The template calls
formatTimeUntil(task.due_date)twice in each location, which repeats date parsing/computation and makes the expression hard to read. Compute the value once (e.g., a computed property or a small helper in<script setup>) and render it with a simple conditional, improving readability and avoiding duplicated work.The template calls
formatTimeUntil(task.due_date)twice in each location, which repeats date parsing/computation and makes the expression hard to read. Compute the value once (e.g., a computed property or a small helper in<script setup>) and render it with a simple conditional, improving readability and avoiding duplicated work.@ -47,7 +47,63 @@ export function useDate() {return `${year}-${month}-${day}`;formatTimeUntilacceptsstring | Date, but it always applies a timezone-offset correction. If aDateinstance is already in local time (common when dates are constructed in-app), adding the timezone offset will shift the day and can produce an incorrect countdown. Consider handlingDateinputs without applying the offset correction (clone + normalize to midnight), and only apply the offset correction for string inputs that parse as UTC dates. Also, theif (!dateString)guard suggests the function expects nullable inputs—either widen the parameter type to includenull | undefinedor remove the guard to keep the API contract consistent.Computing
totalDaysvia(msDiff / 86400000)andMath.roundcan be off by ±1 around DST transitions because a “day” may be 23 or 25 hours in local time. Since you’re working with date-only semantics, consider using a DST-safe approach (e.g., comparing UTC date components /Date.UTC(y,m,d)values) or useMath.ceilfor positive diffs after normalizing to midnight to avoid rounding down unexpectedly.@copilot apply changes based on this feedback
Done in commit
1443c3d. Added ataskTimeUntilcomputed property that evaluatesformatTimeUntil(props.task.due_date)once, and both template locations (chip and card view) now referencetaskTimeUntildirectly.@copilot apply changes based on this feedback
This was already handled in commit
1443c3d— thetaskTimeUntilcomputed property (line 86) covers both the chip view (line 109) and the card view (line 154).🤷♂️