From 758b102550d83729e898ae9356b5575ac16553e2 Mon Sep 17 00:00:00 2001 From: DTTerastar Date: Tue, 21 Apr 2026 20:05:19 -0400 Subject: [PATCH] fix: parse --start/--end dates in local time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, time.ParseInLocation(..., time.UTC) meant --start 2025-01-01 resolved to UTC midnight — which in EDT is Dec 31 at 8pm local. The API received the wrong calendar boundary, silently shifting results by one day for users west of UTC. Parse with ref.Location() so absolute dates match the user's local calendar, consistent with --today (which was already local) and with the package docstring's explicit promise. Co-Authored-By: Claude Opus 4.7 (1M context) --- internal/cronoclient/daterange.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cronoclient/daterange.go b/internal/cronoclient/daterange.go index 7e5941d..c4ac69b 100644 --- a/internal/cronoclient/daterange.go +++ b/internal/cronoclient/daterange.go @@ -59,13 +59,13 @@ func resolveDateRange(startStr, endStr string, days int, today bool, ref time.Ti default: var err error if startStr != "" { - start, err = time.ParseInLocation(dateLayout, startStr, time.UTC) + start, err = time.ParseInLocation(dateLayout, startStr, ref.Location()) if err != nil { return DateRange{}, fmt.Errorf("bad --start: %w", err) } } if endStr != "" { - end, err = time.ParseInLocation(dateLayout, endStr, time.UTC) + end, err = time.ParseInLocation(dateLayout, endStr, ref.Location()) if err != nil { return DateRange{}, fmt.Errorf("bad --end: %w", err) }