feat: Add human-friendly date parsing to list and summary commands#37
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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-DDparsing) backed bygithub.com/jinzhu/nowwith Monday week start. - Replaces single-day DB fetch (
FindAllTimeEntries) with range-based fetch (FindTimeEntriesInRange) across repository and mocks. - Extends
tl summaryto 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
jinzhu/now library (week starts Monday)
interface, allowing date-range queries for week/month keywords
ParseHumanDate("this week", ...)
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com