{"record":{"id":"972f76e534bd7e32","repo":"larksuite/cli","slug":"date-expects-an-iso-yyyy-mm-dd-string-got-s","errorCode":null,"errorMessage":"date expects an ISO yyyy-mm-dd string, got %s","messagePattern":"date expects an ISO yyyy-mm-dd string, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/lark_sheet_table_io.go","lineNumber":704,"sourceCode":"\t\tcell[\"value\"] = raw\n\tcase \"string\":\n\t\tcell[\"value\"] = stringifyCellValue(raw)\n\tcase \"number\":\n\t\tn, ok := raw.(json.Number)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"number expects a numeric value, got %s\", describeJSONType(raw)) //nolint:forbidigo // intermediate error; callers wrap it into a typed --sheets/--values validation error with row/column context\n\t\t}\n\t\tcell[\"value\"] = n\n\tcase \"bool\":\n\t\tb, ok := raw.(bool)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"bool expects true/false, got %s\", describeJSONType(raw)) //nolint:forbidigo // intermediate error; callers wrap it into a typed --sheets/--values validation error with row/column context\n\t\t}\n\t\tcell[\"value\"] = b\n\tcase \"date\":\n\t\tstr, ok := raw.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"date expects an ISO yyyy-mm-dd string, got %s\", describeJSONType(raw)) //nolint:forbidigo // intermediate error; callers wrap it into a typed --sheets/--values validation error with row/column context\n\t\t}\n\t\tserial, err := isoDateToSerial(str)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcell[\"value\"] = serial\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported type %q\", col.Type) //nolint:forbidigo // intermediate error; callers wrap it into a typed --sheets/--values validation error with row/column context\n\t}\n\treturn cell, nil\n}\n\n// stringifyCellValue renders any JSON scalar as the literal text a string\n// column should hold. json.Number keeps its exact digits (no scientific\n// notation), so IDs / postcodes survive as written.\nfunc stringifyCellValue(raw interface{}) string {\n\tswitch v := raw.(type) {\n\tcase string:","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/lark_sheet_table_io.go#L686-L722","documentation":"A column declared \"date\" must carry an ISO yyyy-mm-dd string because buildTypedCell parses it into an Excel serial for the sheet. A non-string JSON value (number, bool, object, null) fails this type check; the caller adds row/column context and wraps it in a typed validation error.","triggerScenarios":"Date column given epoch numbers, JSON null for empty cells, or already-serialized date objects instead of \"2026-01-31\" strings.","commonSituations":"Feeding JS Date or epoch millis directly into the payload; null gaps in a date column; converters emitting numbers for dates.","solutions":["Convert values to \"yyyy-mm-dd\" strings, e.g. \"2026-01-31\" (ISO datetime strings like 2026-01-31T09:00:00Z are also accepted)","If values are raw numbers/text, change the column dtype to \"number\" or \"object\"","Replace null/empty cells with real dates or drop those rows"],"exampleFix":"// before\n{\"name\":\"Due\",\"type\":\"date\",\"data\":[1738368000]}\n// after\n{\"name\":\"Due\",\"type\":\"date\",\"data\":[\"2026-01-31\"]}","handlingStrategy":"validation","validationCode":"function assertDateColumn(col) {\n  col.data.forEach((v, i) => {\n    if (typeof v !== 'string' || !/^\\d{4}-\\d{2}-\\d{2}(T[0-9:.+Z-]+)?$/.test(v))\n      throw new Error(`column ${col.name} (date): row ${i} value ${JSON.stringify(v)} is not an ISO date string`);\n  });\n}","typeGuard":"function isISODateString(v) { return typeof v === 'string' && /^\\d{4}-\\d{2}-\\d{2}(T[0-9:.+Z-]+)?$/.test(v); }","tryCatchPattern":"try {\n  await run(['lark','sheet','table-put','--sheets',payload]);\n} catch (e) {\n  if (/date expects an ISO yyyy-mm-dd string/.test(e.message)) {\n    // convert epoch numbers/Date objects to 'yyyy-mm-dd' strings and retry\n  }\n  throw e;\n}","preventionTips":["Normalize all dates to 'yyyy-mm-dd' strings before building the payload","Convert epoch millis / JS Date objects with toISOString().slice(0,10)","Use dtype \"object\" for non-ISO date-like text"],"tags":["cli","json","validation","sheets","date"],"backgroundTag":"schema-validation-failed","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"}