mirror of
https://github.com/aculix/negotium.git
synced 2026-09-11 07:28:17 +00:00
feat: add day-rollover with multi-day carry-forward
Replaces checkAndMigrateTasks, which never ran. Its guard compared currentDate, set from new Date() at init, against a fresh new Date() a few milliseconds later in onMount, so it was never true. Unfinished tasks have been sitting under old date keys ever since. The rule now: unfinished tasks from every prior day move into today, oldest first, ahead of whatever is already there. Completed ones are dropped and the old key deleted. It spans gaps, which the original never did even in theory, since it only looked one day back. now is a parameter. That's the part that makes the boundary testable.
This commit is contained in:
@@ -731,7 +731,7 @@ export function msUntilNextMidnight(now) {
|
||||
|
||||
`listTaskKeys` already filters to well-formed ISO keys, so the `< todayKey` string comparison is safe — and sortable keys are exactly why the format changed. Building next midnight from local calendar parts keeps it DST-correct: on a spring-forward day the interval is genuinely 23 hours, and this returns 23 hours.
|
||||
|
||||
Note the empty-carry case: when every prior day held only completed tasks, `carried` is empty but the prior keys are still deleted, and today's list is rewritten unchanged. That is intended — pruning is the point.
|
||||
Note the empty-carry case: when every prior day held only completed tasks, the prior keys are still deleted but today's key is left alone — writing an empty array would create a key for nothing, and rollover runs on every focus and visibility change. Persist only when something actually moved.
|
||||
|
||||
- [ ] **Step 4: Run to verify pass**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user