{"record":{"id":"1ed39597dfe910c6","repo":"theonedev/onedev","slug":"unrecognized-date-value","errorCode":null,"errorMessage":"Unrecognized date: ${value}","messagePattern":"Unrecognized date: (.+?)","errorType":"exception","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/util/QueryUtils.java","lineNumber":121,"sourceCode":"\t\tProject project = OneDev.getInstance(ProjectService.class).findByPath(projectPath);\n\t\tif (project == null)\n\t\t\tthrow new NotFoundException(\"Unable to find project '\" + projectPath + \"'\");\n\t\treturn project;\n\t}\n\t\n\tpublic static boolean getBooleanValue(String value) {\n\t\tif (value.equals(\"true\"))\n\t\t\treturn true;\n\t\telse if (value.equals(\"false\"))\n\t\t\treturn false;\n\t\telse\n\t\t\tthrow new NotAcceptableException(\"Invalid boolean: \" + value);\n\t}\n\t\n\tpublic static Date getDateValue(String value) {\n\t\tDate dateValue = DateUtils.parseRelaxed(value);\n\t\tif (dateValue == null)\n\t\t\tthrow new NotAcceptableException(\"Unrecognized date: \" + value);\n\t\treturn dateValue;\n\t}\n\n\tpublic static ProjectScopedCommit getCommitId(@Nullable Project project, String value) {\n\t\tif (project != null && !value.contains(\":\"))\n\t\t\tvalue = project.getPath() + \":\" + value;\n\t\tProjectScopedCommit commitId = ProjectScopedCommit.from(value);\n\t\tif (commitId != null && commitId.getCommitId() != null)\n\t\t\treturn commitId;\n\t\telse\n\t\t\tthrow new NotFoundException(\"Unable to find revision: \" + value);\n\t}\n\n\tpublic static ProjectScopedRevision getRevision(@Nullable Project project, String value) {\n\t\tif (project != null && !value.contains(\":\"))\n\t\t\tvalue = project.getPath() + \":\" + value;\n\t\tProjectScopedRevision revision = ProjectScopedRevision.from(value);\n\t\tif (revision != null)","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/QueryUtils.java#L103-L139","documentation":"QueryUtils.getDateValue parses a date string using DateUtils.parseRelaxed, which accepts many common formats but not everything. If parsing returns null, a NotAcceptableException 'Unrecognized date' is thrown. This happens when query/criteria values contain date literals in an unsupported format.","triggerScenarios":"Calling QueryUtils.getDateValue with a string DateUtils.parseRelaxed cannot interpret — e.g. '2026/13/45' (invalid parts), 'March 3rd', locale-specific formats like '03.03.2026', or epoch milliseconds as a bare number if unsupported.","commonSituations":"Users typing dates in their locale's format (DD.MM.YYYY vs MM/DD/YYYY); misspelled relative expressions (e.g. 'last week' vs supported relative syntax like '1w'); ISO strings with unexpected timezone suffixes; typos in the date value.","solutions":["Use a widely accepted format like ISO 8601: '2026-09-06' or '2026-09-06T12:00:00Z'","If the query syntax supports relative dates, use supported relative expressions (e.g. '1w ago' style) instead of free-form text","Pre-validate the string with java.time parsing (LocalDate.parse with a DateTimeFormatter) before calling the utility","Catch NotAcceptableException and show the supported date formats in the error message"],"exampleFix":"// before\nDate d = QueryUtils.getDateValue(\"06.09.2026\");\n// after\nDate d = QueryUtils.getDateValue(\"2026-09-06\");","handlingStrategy":"validation","validationCode":"try {\n    java.time.LocalDate.parse(value);\n} catch (java.time.format.DateTimeParseException e) {\n    throw new UserException(\"Unsupported date format: \" + value + \", use ISO 8601 like 2026-09-06\");\n}","typeGuard":"boolean isParsableDate(String s) {\n    return DateUtils.parseRelaxed(s) != null;\n}","tryCatchPattern":"try {\n    Date d = QueryUtils.getDateValue(value);\n} catch (NotAcceptableException e) {\n    // show supported formats to the user\n}","preventionTips":["Standardize on ISO 8601 dates in queries and configs","Avoid locale-specific date entry; use a date picker that emits ISO strings","Test date values with DateUtils.parseRelaxed before persisting them in saved queries"],"tags":["date","parsing","validation","onedev"],"backgroundTag":"invalid-date-format","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}