Skip to content

feat: Add human-friendly date parsing to list and summary commands#37

Merged
kimpepper merged 2 commits into
mainfrom
human-readable-dates
Mar 18, 2026
Merged

feat: Add human-friendly date parsing to list and summary commands#37
kimpepper merged 2 commits into
mainfrom
human-readable-dates

Conversation

@kimpepper
Copy link
Copy Markdown
Member

Adds support for date keywords ('today', 'yesterday', 'this week',
'last week', 'this month', 'last month') and YYYY-MM-DD strings to the
--date flag on tl list and tl summary.

  • Introduces util.ParseHumanDate backed by the already-vendored
    jinzhu/now library (week starts Monday)
  • Replaces FindAllTimeEntries with FindTimeEntriesInRange on the DB
    interface, allowing date-range queries for week/month keywords
  • Adds --date flag to tl summary; mutually exclusive with --start/--end
  • Removes the hand-rolled startOfCurrentWeek() helper in favour of
    ParseHumanDate("this week", ...)

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Adds support for date keywords ('today', 'yesterday', 'this week',
'last week', 'this month', 'last month') and YYYY-MM-DD strings to the
--date flag on tl list and tl summary.

- Introduces util.ParseHumanDate backed by the already-vendored
  jinzhu/now library (week starts Monday)
- Replaces FindAllTimeEntries with FindTimeEntriesInRange on the DB
  interface, allowing date-range queries for week/month keywords
- Adds --date flag to tl summary; mutually exclusive with --start/--end
- Removes the hand-rolled startOfCurrentWeek() helper in favour of
  ParseHumanDate("this week", ...)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds human-friendly --date parsing for tl list and tl summary (keywords + YYYY-MM-DD), and updates the storage layer to support querying by arbitrary date ranges to enable week/month keywords.

Changes:

  • Introduces internal/util.ParseHumanDate (keyword + YYYY-MM-DD parsing) backed by github.com/jinzhu/now with Monday week start.
  • Replaces single-day DB fetch (FindAllTimeEntries) with range-based fetch (FindTimeEntriesInRange) across repository and mocks.
  • Extends tl summary to accept --date (mutually exclusive with --start/--end) and updates tests/examples accordingly.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/util/dateparse.go Implements human-friendly date parsing to start/end timestamps + label.
internal/util/dateparse_test.go Adds unit tests for keywords and YYYY-MM-DD parsing.
internal/db/time_entries.go Updates DB interface and repository implementation to query entries by date range.
internal/db/repository.go Removes now-unused day-range helper.
internal/db/mocks/mock_repository.go Updates mock repository to new range-based API.
cmd/list/command.go Switches list to ParseHumanDate + range query; updates help text.
cmd/list/command_test.go Adds coverage for list --date keywords/default/invalid/no entries.
cmd/summary/command.go Adds --date support, mutual exclusion with --start/--end, and label-based output.
cmd/summary/command_test.go Adds coverage for summary --date keywords, conflicts, and YYYY-MM-DD.
internal/service/timer_entry_test.go Updates mock interface implementation to compile with new DB API.
go.mod Promotes jinzhu/now from indirect to direct dependency.
CLAUDE.md Adds contributor tooling guidance.
.gitignore Ignores Claude local settings; reorders .idea.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/util/dateparse.go Outdated
Comment thread cmd/summary/command.go
Comment thread internal/util/dateparse_test.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kimpepper kimpepper merged commit eddc88b into main Mar 18, 2026
1 check passed
@kimpepper kimpepper deleted the human-readable-dates branch March 18, 2026 05:40
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.

2 participants