Skip to content

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

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

ryanlewis merged 2 commits into
mainfrom
fix/dated-when-readback

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

Problem

A date, today or tomorrow with a time after the @ (today@6pm, tomorrow@18:00, 2026-10-12@9pm) went to Things as typed. placeWhen only places YYYY-MM-DD@HH:MM, so the read-back treated these values as holding and reported them confirmed without a check. A misfiled item went unnoticed. #443 fixed the same gap for a bare 12-hour time.

Change

add, project add and edit now resolve the value at send time with one helper, things.ResolveWhen. Today and tomorrow become their dates when the command runs, and the time becomes HH:MM:

  • today@6pm is now sent as <today's date>@18:00
  • tomorrow@9:30 is sent as <tomorrow's date>@09:30
  • 2026-10-12@9pm is sent as 2026-10-12@21:00

Things was never measured with a keyword and a time. This switches to the date and time form measured on 7 Oct 2026, so we no longer rely on how Things reads the keyword. The read-back and the edit no-op check now judge the value that was sent. Messages still show the value as typed.

Midnight edge: "tomorrow" means tomorrow relative to when the command runs. A tomorrow@6pm sent just before midnight is the next day, even if Things reads it after midnight. TestResolveWhen pins this with a clock at 23:59:59.

Not changed

  • evening@6pm and a weekday with a time (friday@9pm) are still sent as typed and not checked. Resolving evening to a date would file the item in the day part, and how Things reads friday on a Friday was never measured.
  • import sends its payload's when as written and is unchanged. It shares the read-back, but placeWhen and NormalizeWhen are untouched, so its verdicts don't change.

Tests

  • TestWhenDatedTimeReadBack: add, project add and edit with each form send YYYY-MM-DD@HH:MM and report a misfile. Before the change, each of these was confirmed.
  • TestResolveWhen: the rewrites, the values left alone, and the midnight edge.
  • TestEditCertainNoOpSkipsTheWait: tomorrow@8am on an item already filed there with that reminder counts as no change.

A date, today or tomorrow with a time after the @ (today@6pm,
tomorrow@18:00, 2026-10-12@9pm) went to Things as typed. placeWhen only
places YYYY-MM-DD@HH:MM, so the read-back treated these as holding and
reported them confirmed without a check.

add, project add and edit now resolve such a value at send time with
things.ResolveWhen: today and tomorrow become their dates when the command
runs, and the time becomes HH:MM. That is the date and time form Things was
measured with on 7 Oct 2026, so the existing read-back judges what was
sent. A keyword with a time was never measured. Messages still name the
value as typed. evening@ and weekday@ values are sent as before.

Import is unchanged: it shares the read-back but sends its payload as
written, and placeWhen and NormalizeWhen are untouched.
The no-op check now judges the value ResolveWhen sends, as the read-back does, so tomorrow@8am on an item already filed there with that reminder returns at once instead of waiting out the budget.
@ryanlewis
ryanlewis merged commit 4147a2e into main Oct 10, 2026
10 checks passed
@ryanlewis
ryanlewis deleted the fix/dated-when-readback branch October 10, 2026 01:50
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