fix(timeutil): accept RFC3339 timestamps in since/until args#62
Merged
Conversation
The flashduty SDK renders timestamps as RFC3339 (e.g. "2026-05-29T00:00:00+08:00"), so an LLM caller naturally copies those values straight out of one tool's output back into the since/until args of the next. timeutil.Parse only understood duration / "2006-01-02" / "2006-01-02 15:04:05" / unix, so it failed with `unable to parse time "2026-05-29T00:00:00+08:00"`. Parse now tries RFC3339/RFC3339Nano (honoring the embedded offset or "Z") before the local-zone layouts, and also accepts the "T"-separated datetime without a timezone. ParseAny delegates strings to Parse, so MCP tool args gain the same support. Output is unchanged; this only widens accepted input to include the exact shape we already emit.
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.
Problem
Same root cause as flashduty-cli#25, in the MCP server's copy of
internal/timeutil.The flashduty SDK renders timestamps as RFC3339 (e.g.
2026-05-29T00:00:00+08:00), so an LLM caller copies those values out of one tool's output and back into thesince/untilargs of the next.timeutil.Parseonly accepted duration /2006-01-02/2006-01-02 15:04:05/ unix — not the RFC3339 we emit — so it failed withunable to parse time "2026-05-29T00:00:00+08:00".Fix
Parsenow triesRFC3339Nano/RFC3339(honoring the embedded offset orZ) before the local-zone layouts, and also accepts theT-separated datetime without a timezone.ParseAny(the MCP tool-arg entry point) delegates strings toParse, so all string-valued time args gain the same support. Output is unchanged; this only widens accepted input to the shape we already emit.Verification
Unit tests cover
+08:00offset,Z, fractional-secondRFC3339Nano, and bare-Tno-tz; suite green, fullgo build ./...clean.