Skip to content

fix(import): send a dated when time as YYYY-MM-DD@HH:MM and read it back as sent - #449

Merged
ryanlewis merged 2 commits into
mainfrom
fix/when-checks
Oct 10, 2026
Merged

ryanlewis merged 2 commits into
mainfrom
fix/when-checks

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

Since #446, add, project add and edit send today@6pm, tomorrow@T and <date>@T as YYYY-MM-DD@HH:MM (things.ResolveWhen) and the read-back judges that value. import still sent the value as typed and checked the raw value, which the read-back cannot place, so it confirmed the item whatever Things did with it.

Changes

  • import rewrites each when in an item's attributes (created items, a project's items, and update items) with things.ResolveWhen at send time. The rest of the payload is sent byte for byte as given.
  • checkWhens judges the sent value (sentAs), using the same send time as the rewrite. A tomorrow@9am that lands in the Inbox is now reported misfiled instead of confirmed.
  • Separate commit: snapshotCreated (the read-back window) reads clock.Now() rather than time.Now(), so it agrees with import's future creation-date check. Nothing changes in production, where both are the wall clock.
  • Docs: commands.md (import when and misfiled) and SKILL.md.

Before / after

Payload [{"type":"to-do","attributes":{"title":"Pay rent","when":"tomorrow@9am"}}] sent on 10 Oct:

  • before: sent as "when":"tomorrow@9am"; reported Created and confirmed wherever Things filed it.
  • after: sent as "when":"2026-10-11@09:00". If Things files it in the Inbox, the import fails: [0]: task "Pay rent" (new-1) was created, but its when "tomorrow@9am" did not file it there: it is in inbox with no start date (reason misfiled).

Tests

TestResolveImportWhens (rewrite, spacing and escapes kept, nested and update items, values outside attributes untouched), TestImportSendsResolvedWhen, new TestImportChecksWhen cases timedMisfiled/timedLanded, and TestSnapshotCreatedReadsClock. make test and make lint pass.

@ryanlewis
ryanlewis merged commit a95f800 into main Oct 10, 2026
10 checks passed
@ryanlewis
ryanlewis deleted the fix/when-checks branch October 10, 2026 14:09
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.

1 participant