fix(calendar): use midnight of next day as endOfDay to avoid truncation#510
Closed
dinakars777 wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(calendar): use midnight of next day as endOfDay to avoid truncation#510dinakars777 wants to merge 1 commit intoopenclaw:mainfrom
dinakars777 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
endOfDay() previously returned 23:59:59.999999999, but FormatRFC3339() uses time.RFC3339 which truncates to second precision, producing 23:59:59. Since the Calendar API's timeMax is exclusive, events starting at exactly 23:59:59 were silently dropped from --today, --week, and --days queries. Change endOfDay to return midnight of the next day so that RFC3339 formatting preserves the full day range regardless of precision. Closes openclaw#367
Collaborator
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.
Summary
endOfDay()previously returned23:59:59.999999999, butFormatRFC3339()usestime.RFC3339which truncates to second precision, producing23:59:59. Since the Google Calendar API'stimeMaxparameter is exclusive, events starting at exactly 23:59:59 are silently dropped from--today,--week, and--daysqueries.Impact
This is the root cause of issue #367 where
calendar events listreturns 404 or missing results when using--today,--from, or--daysflags. Events near midnight are silently excluded.Changes
endOfDay()to return midnight of the next day (startOfDay(t.AddDate(0, 0, 1))) instead of23:59:59.999999999timeMaxTest plan
go build ./...compiles cleanlygo test ./internal/cmd/... -run TimeRange -v— all passgog calendar events list --todayincludes events at 23:59gog calendar events list --weekcovers the full weekCloses #367