{"record":{"id":"b4d9a571bc237df1","repo":"jackwener/OpenCLI","slug":"kwargs-time-2025-04-01-14-00","errorCode":null,"errorMessage":"时间格式错误: ${kwargs.time}，请使用格式如 2025-04-01 14:00","messagePattern":"时间格式错误: (.+?)，请使用格式如 2025-04-01 14:00","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clis/boss/invite.js","lineNumber":42,"sourceCode":"        verbose(`Sending interview invitation to ${kwargs.uid}...`);\n        await navigateToChat(page);\n        const friend = await findFriendByUid(page, kwargs.uid, { checkGreetList: true });\n        if (!friend)\n            throw new Error('未找到该候选人');\n        const friendName = friend.name || '候选人';\n        // Get saved contact info\n        const contactData = await bossFetch(page, 'https://www.zhipin.com/wapi/zpinterview/boss/interview/contactInit', { allowNonZero: true, timeout: 10_000 });\n        const contactName = kwargs.contact || contactData.zpData?.contactName || '';\n        const contactPhone = contactData.zpData?.contactPhone || '';\n        const contactId = contactData.zpData?.contactId || '';\n        // Get saved address\n        const addressData = await bossFetch(page, 'https://www.zhipin.com/wapi/zpinterview/boss/interview/listAddress', { allowNonZero: true, timeout: 10_000 });\n        const savedAddress = addressData.zpData?.list?.[0] || {};\n        const addressText = kwargs.address || savedAddress.cityAddressText || savedAddress.addressText || '';\n        // Parse interview time\n        const interviewTime = new Date(kwargs.time).getTime();\n        if (isNaN(interviewTime)) {\n            throw new Error(`时间格式错误: ${kwargs.time}，请使用格式如 2025-04-01 14:00`);\n        }\n        const params = new URLSearchParams({\n            uid: String(friend.uid),\n            securityId: friend.securityId || '',\n            encryptJobId: friend.encryptJobId || '',\n            interviewTime: String(interviewTime),\n            contactId,\n            contactName,\n            contactPhone,\n            address: addressText,\n            interviewType: '1',\n        });\n        await bossFetch(page, 'https://www.zhipin.com/wapi/zpinterview/boss/interview/invite.json', {\n            method: 'POST',\n            body: params.toString(),\n        });\n        return [{\n                status: '✅ 面试邀请已发送',","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/boss/invite.js#L24-L60","documentation":"`opencli boss invite` parses the --time argument with `new Date(kwargs.time).getTime()`. JavaScript's Date parsing is lenient but locale/region-dependent; if the value cannot be parsed (NaN), the command throws this Chinese 'invalid time format' error suggesting the 'YYYY-MM-DD HH:mm' shape. The parsed epoch ms is sent as interviewTime to BOSS's interview API.","triggerScenarios":"Passing --time values like '04/01 2pm', '明天下午2点', '2025-4-1 14:0', or values with timezone suffixes that the runtime's V8 build fails to parse; also passing an empty or missing --time (new Date(undefined) → NaN).","commonSituations":"Users writing times in their locale format (US MM/DD/YYYY, Chinese natural language); omitting --time entirely; extra characters from shell quoting; non-Gregorian or relative date strings.","solutions":["Use the exact format '2025-04-01 14:00' (24-hour, zero-padded).","Ensure --time is actually passed and non-empty.","Quote the value in the shell so spaces survive: --time \"2025-04-01 14:00\".","Convert locale formats (e.g. 04/01/2025 2:00 PM) to ISO-like form before invoking."],"exampleFix":"// before\nopencli boss invite <uid> --time \"明天下午2点\"\n// after\nopencli boss invite <uid> --time \"2025-04-01 14:00\"","handlingStrategy":"validation","validationCode":"function parseInterviewTime(s) {\n  if (!/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$/.test(s)) {\n    throw new Error(`Bad time \"${s}\"; use 2025-04-01 14:00`);\n  }\n  const ms = new Date(s.replace(' ', 'T')).getTime();\n  if (Number.isNaN(ms)) throw new Error(`Unparseable time: ${s}`);\n  return ms;\n}","typeGuard":"function isValidTimeString(v) {\n  return typeof v === 'string' && !Number.isNaN(new Date(v.replace(' ', 'T')).getTime());\n}","tryCatchPattern":"try {\n  await run(['opencli', 'boss', 'invite', uid, '--time', '2025-04-01 14:00']);\n} catch (e) {\n  if (e.message.includes('时间格式错误')) {\n    console.error('Format the time as YYYY-MM-DD HH:mm (24h, zero-padded).');\n  }\n  throw e;\n}","preventionTips":["Always pass --time as 'YYYY-MM-DD HH:mm'.","Quote the argument in shell to preserve the space.","Never pass natural-language or locale-formatted dates.","Validate with a regex before invoking the command."],"tags":["date-parsing","argument-validation","boss"],"backgroundTag":"invalid-date-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}