{"record":{"id":"dee213bf3f7ba946","repo":"larksuite/cli","slug":"set-calendar-event-start-must-be-a-valid-iso-8601","errorCode":null,"errorMessage":"set_calendar: event_start must be a valid ISO 8601 timestamp","messagePattern":"set_calendar: event_start must be a valid ISO 8601 timestamp","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/model.go","lineNumber":355,"sourceCode":"\t\tif !op.Target.hasKey() {\n\t\t\treturn fmt.Errorf(\"remove_inline requires target with at least one of part_id or cid\")\n\t\t}\n\tcase \"insert_signature\":\n\t\tif strings.TrimSpace(op.SignatureID) == \"\" {\n\t\t\treturn fmt.Errorf(\"insert_signature requires signature_id\")\n\t\t}\n\tcase \"remove_signature\":\n\t\t// No required fields.\n\tcase \"set_calendar\":\n\t\tif strings.TrimSpace(op.EventSummary) == \"\" {\n\t\t\treturn fmt.Errorf(\"set_calendar requires event_summary\")\n\t\t}\n\t\tif strings.TrimSpace(op.EventStart) == \"\" || strings.TrimSpace(op.EventEnd) == \"\" {\n\t\t\treturn fmt.Errorf(\"set_calendar requires event_start and event_end\")\n\t\t}\n\t\tstart, err := parseISO8601(op.EventStart)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"set_calendar: event_start must be a valid ISO 8601 timestamp\")\n\t\t}\n\t\tend, err := parseISO8601(op.EventEnd)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"set_calendar: event_end must be a valid ISO 8601 timestamp\")\n\t\t}\n\t\tif !end.After(start) {\n\t\t\treturn fmt.Errorf(\"set_calendar: event_end must be after event_start\")\n\t\t}\n\tcase \"remove_calendar\":\n\t\t// No required fields.\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported op %q\", op.Op)\n\t}\n\treturn nil\n}\n\nfunc isRecipientField(field string) bool {\n\tswitch strings.ToLower(strings.TrimSpace(field)) {","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/model.go#L337-L373","documentation":"This error is returned by draft patch validation when a `set_calendar` operation supplies an `event_start` value that is non-empty but cannot be parsed by parseISO8601. The parser only accepts a small set of ISO 8601 layouts (RFC 3339 with seconds, RFC 3339 without seconds, and the same two without a timezone offset), so anything else — such as Unix epoch millis, 'YYYY/MM/DD', locale-formatted dates, or date-only strings like '2026-09-04' — fails. The original parse error is discarded, so the message does not reveal which layout was attempted.","triggerScenarios":"Calling the draft patch (set_calendar op) with event_start set to a non-ISO-8601 string: epoch milliseconds (1725400000000), slash-formatted dates (2026/09/04 10:00), date-only values (2026-09-04), 'MMM D, YYYY' locale formats, or timestamps missing the T separator (2026-09-04 10:00:00).","commonSituations":"Passing a JavaScript Date.toString() or new Date().toISOString() variant the parser does not know; feeding backend timestamps that are epoch-based; copying human-readable dates from a calendar UI; forgetting timezone offsets in a format the layout list requires.","solutions":["Reformat event_start to RFC 3339 with seconds and an explicit offset, e.g. 2026-09-04T10:00:00+08:00 or 2026-09-04T02:00:00Z","If you have an epoch number, convert it first: time.UnixMilli(ms).UTC().Format(time.RFC3339)","Use one of the four accepted shapes: RFC3339 (2006-01-02T15:04:05Z07:00), 2006-01-02T15:04Z07:00, 2006-01-02T15:04:05, or 2006-01-02T15:04","Validate the string with a strict ISO 8601 regex or time.Parse(time.RFC3339, s) before submitting the patch"],"exampleFix":"// before\nops := []Op{{Op: \"set_calendar\", EventSummary: \"Sync\", EventStart: \"2026-09-04 10:00\", EventEnd: \"2026-09-04 11:00\"}}\n// after\nops := []Op{{Op: \"set_calendar\", EventSummary: \"Sync\", EventStart: \"2026-09-04T10:00:00+08:00\", EventEnd: \"2026-09-04T11:00:00+08:00\"}}","handlingStrategy":"validation","validationCode":"func validTimestamp(s string) bool {\n    _, err := time.Parse(time.RFC3339, s)\n    return err == nil\n}\nif !validTimestamp(op.EventStart) {\n    return fmt.Errorf(\"event_start must be RFC 3339, got %q\", op.EventStart)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always generate timestamps with time.Now().Format(time.RFC3339) or an equivalent RFC 3339 formatter","Never pass epoch integers, locale date strings, or Date.toString() output as event_start","Add a pre-submit validation step that parses both timestamps client-side","Keep a single shared timestamp-formatting helper instead of ad hoc formatting per call site"],"tags":["validation","iso8601","calendar","draft-patch"],"backgroundTag":"invalid-timestamp-format","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}