{"record":{"id":"defe5bc59c02b7a5","repo":"handsontable/handsontable","slug":"timeeditor-value-must-be-in-24-hour-time-format","errorCode":null,"errorMessage":"TimeEditor: value must be in 24-hour time format (\"HH:mm\", \"HH:mm:ss\" or \"HH:mm:ss.SSS\") required by the native time input. Received:","messagePattern":"TimeEditor: value must be in 24-hour time format \\(\"HH:mm\", \"HH:mm:ss\" or \"HH:mm:ss\\.SSS\"\\) required by the native time input\\. Received:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"handsontable/src/editors/timeEditor/timeEditor.ts","lineNumber":48,"sourceCode":"    });\n  }\n\n  /**\n   * Creates the editor's textarea element as a native time input.\n   */\n  createElements(type?: string): void {\n    super.createElements('input');\n\n    this.TEXTAREA.setAttribute('type', 'time');\n    this.TEXTAREA.setAttribute('dir', 'ltr');\n  }\n\n  /**\n   * Sets the editor value and warns if the value does not match the 24-hour time format required by the native time input.\n   */\n  setValue(value?: unknown): void {\n    if (!isValidTime(value)) {\n      warn(toSingleLine`TimeEditor: value must be in 24-hour time format (\"HH:mm\", \"HH:mm:ss\" or \"HH:mm:ss.SSS\")\\x20\n        required by the native time input. Received:`, value);\n\n      super.setValue('');\n\n      return;\n    }\n\n    super.setValue(value);\n  }\n\n  /**\n   * Selects all text in the time input element when the editor receives focus.\n   */\n  focus(): void {\n    this.TEXTAREA.select();\n  }\n\n  /**","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/handsontable/handsontable/blob/2c365a3291b45a331a6de1ed10a9deba683cfbc3/handsontable/src/editors/timeEditor/timeEditor.ts#L30-L66","documentation":"TimeEditor backs the native `<input type=\"time\">`, which accepts only 24-hour times: \"HH:mm\", \"HH:mm:ss\", or \"HH:mm:ss.SSS\". If the value set on the editor does not match, Handsontable warns and clears the input to keep the native control valid.","triggerScenarios":"Cell values like \"9:30\", \"09:30 AM\", \"09:30 AM/PM\" 12-hour strings, \"25:99\", or Date objects passed to a time-typed column.","commonSituations":"Importing 12-hour formatted times; user data from spreadsheets with AM/PM; APIs returning times with date prefixes or timezone info.","solutions":["Normalize times to 24-hour \"HH:mm[:ss[.SSS]]\" before loading them into the grid","Use a beforeChange hook or data getter to convert 12-hour times","Validate/fix upstream data at import time","Use a text column with a custom renderer if you must display other formats"],"exampleFix":"// before\nvalue = '09:30 PM';\n// after\nvalue = '21:30'; // convert to 24-hour HH:mm","handlingStrategy":"validation","validationCode":"const TIME = /^([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d(\\.\\d{1,3})?)?$/;\nif (!TIME.test(String(value))) value = convertTo24h(value);","typeGuard":"function isValidTime(v) {\n  return typeof v === 'string' && /^([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d(\\.\\d{1,3})?)?$/.test(v);\n}","tryCatchPattern":null,"preventionTips":["Normalize 12-hour/AM-PM times at import time","Reject or convert times carrying date or timezone parts","Validate times in the backend before serving grid data"],"tags":["time-editor","validation","time-format"],"backgroundTag":"invalid-time-format","analyzedSha":"2c365a3291b45a331a6de1ed10a9deba683cfbc3","analyzedAt":"2026-09-01T10:26:16.720Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}