feat: accept days and weeks in --since and --until

tea issue list --since 7d was rejected; only h, m and s durations worked.
Time bounds such as --since, --until and --before now also take whole
days and weeks: 7d, 2w.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 00:17:08 +02:00
1 parent 5d2f2d83eb
commit 56c6ffc80b
2 files changed
+18 -2

No files matched your search

+3 -1
View File
@@ -19,6 +19,8 @@ func TestParseRunTime(t *testing.T) {
expected time.Time
}{
{"24h", now.Add(-24 * time.Hour)},
{"7d", now.Add(-7 * 24 * time.Hour)},
{"2w", now.Add(-14 * 24 * time.Hour)},
{"0s", now},
{"2028-01-01", time.Date(2028, 1, 1, 0, 0, 0, 0, plus2)},
{"2028-01-01T00:30:00+02:00", time.Date(2027, 12, 31, 22, 30, 0, 0, time.UTC)},
@@ -28,7 +30,7 @@ func TestParseRunTime(t *testing.T) {
require.NoError(t, err)
require.True(t, result.Equal(tc.expected), tc.input)
}
for _, input := range []string{"", "-24h", "not-a-date", "2028-02-30"} {
for _, input := range []string{"", "-24h", "not-a-date", "2028-02-30", "-1d", "1.5w"} {
_, err := parseRunTime(input, now)
require.Error(t, err, input)
}