Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse converts a time string to a unix timestamp (seconds). Supported formats:
- Go duration (relative to now): "5m", "1h", "24h", "168h" Interpreted as "now minus duration"
- Future duration with "+" prefix: "+24h", "+7d" Interpreted as "now plus duration"
- Day shorthand: "7d", "30d" — converted to hours automatically
- Date: "2026-04-01" (parsed as local midnight)
- Datetime: "2026-04-01 10:00:00" or "2026-04-01T10:00:00" (parsed as local time)
- RFC3339 with timezone: "2026-04-01T10:00:00+08:00" / "...Z" (the format the SDK emits)
- Unix timestamp: "1712000000" (passed through)
func ParseAny ¶
ParseAny accepts the same string formats as Parse, plus raw numeric unix seconds (any of float64, int, int64). Empty string and nil return 0 with no error so callers can distinguish "not provided" from a parse failure.
This exists because MCP arguments arrive as map[string]any: LLM-friendly callers pass strings ("24h"), while legacy callers and e2e tests pass raw int64. Both paths must work without forcing every call site to branch on type.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.