Skip to content

Commit 93b7ec1

Browse files
committed
Fix reports schedule 400 error when called without date flags
The Basecamp API requires a date window for the upcoming schedule endpoint. When --start/--end were omitted, nil params caused a 400 Bad Request. Default to today..+14 days.
1 parent b1647d6 commit 93b7ec1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/commands/reports.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func newReportsScheduleCmd() *cobra.Command {
261261
Short: "View upcoming schedule entries",
262262
Long: `View upcoming schedule entries and assignables within a date window.
263263
264-
By default shows the upcoming schedule. Use --start and --end to specify a date range.
264+
By default starts from today. Use --start and --end to specify a different range.
265265
Dates can be natural language (e.g., "today", "next week", "+7") or YYYY-MM-DD format.`,
266266
RunE: func(cmd *cobra.Command, args []string) error {
267267
app := appctx.FromContext(cmd.Context())
@@ -272,6 +272,10 @@ Dates can be natural language (e.g., "today", "next week", "+7") or YYYY-MM-DD f
272272

273273
// Parse dates if provided (dateparse handles natural language like "today", "+7")
274274
// Unrecognized formats are normalized (trimmed/lowercased) and passed through for the API to validate
275+
// Default start to today when omitted (API requires at least a start date)
276+
if startDate == "" {
277+
startDate = "today"
278+
}
275279
parsedStart := dateparse.Parse(startDate)
276280
parsedEnd := dateparse.Parse(endDate)
277281

0 commit comments

Comments
 (0)