Skip to content

fix(when): stop rejecting weekday names like "monday"#103

Merged
ryanlewis merged 1 commit into
mainfrom
fix/when-weekday-typo
Jun 13, 2026
Merged

fix(when): stop rejecting weekday names like "monday"#103
ryanlewis merged 1 commit into
mainfrom
fix/when-weekday-typo

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

The bug

--when monday was rejected client-side with "did you mean today?". The --when handler runs a typo detector that flags any input within Levenshtein distance 2 of a keyword — and levenshtein("monday", "today") == 2, so monday was swallowed as a "typo" of today.

monday is the only weekday that collides (the rest are distance ≥3 from every keyword), which is why it slipped through. It also directly contradicts SKILL.md, which advertises:

things edit 3 --when monday              # weekday names work

The fix

Add a weekday allowlist (mondaysunday plus mon/tue/wed/… abbreviations) checked before the typo detector in NormalizeWhen. Weekday names are valid natural-language values Things accepts verbatim, so they pass through with original casing.

  • internal/things/dates.goweekdayWords allowlist + isWeekdayWord guard
  • internal/things/dates_test.go — cases for monday, Monday, tuesday, sunday, mon

Verification

  • gofmt clean
  • go test -race ./internal/things/ — 76 passed
  • go build ./cmd/things — OK
  • golangci-lint run — no issues
  • Typo detector still rejects genuine typos (tommorrow, evning, …) — existing test unchanged and passing

`--when monday` was rejected with "did you mean today?" because
levenshtein("monday","today") == 2, inside the typo-detection
threshold. Weekday names are valid natural-language values that
Things accepts verbatim (and SKILL.md already documents them).

Allowlist weekday names and their abbreviations so they bypass the
keyword typo detector before nearKeyword runs.
@ryanlewis

Copy link
Copy Markdown
Owner Author

Manual verification against live Things3

Built the branch and created test tasks for every allowlisted weekday form, then read back the startDate Things assigned (today = Sat 2026-06-13):

input → startDate day
monday / mon 2026-06-15 Mon ✓
tue / tues 2026-06-16 Tue ✓
wed 2026-06-17 Wed ✓
thu / thur / thurs 2026-06-18 Thu ✓
friday 2026-06-19 Fri ✓
sat 2026-06-20 Sat ✓
sun 2026-06-14 Sun ✓

All resolved to a correctly scheduled date (start=2). Confirms Things' NL parser handles both full names and abbreviations downstream — no silent "lands in Anytime" failures, including the non-standard tues/thur/thurs. Test tasks cleaned up afterward.

@ryanlewis ryanlewis merged commit 119369d into main Jun 13, 2026
1 check passed
@ryanlewis ryanlewis deleted the fix/when-weekday-typo branch June 13, 2026 17:22
ryanlewis added a commit that referenced this pull request Jun 13, 2026
Release notes header for **v0.4.2**, required at the tagged commit by
`.goreleaser.yaml` (`readFile`).

v0.4.2 is a patch release shipping the `--when` weekday fix from #103:
`things add --when monday` was wrongly rejected as a typo of `today`
(Levenshtein distance 2). Weekday names and abbreviations now pass
through to Things, verified against Things3.

Merge → then tag `v0.4.2`.
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