{"record":{"id":"955c25c13380b712","repo":"JetBrains/intellij-community","slug":"offset-out-of-range-from-12-00-to-14-00","errorCode":null,"errorMessage":"Offset out of range (from -12:00 to +14:00)","messagePattern":"Offset out of range \\(from -12:00 to \\+14:00\\)","errorType":"exception","errorClass":"DateTimeException","httpStatus":null,"severity":"error","filePath":"grid/core-impl/src/run/ui/grid/editors/ZonedTimeDelegate.java","lineNumber":24,"sourceCode":"import java.time.LocalTime;\nimport java.time.OffsetTime;\nimport java.time.ZoneOffset;\nimport java.time.temporal.ChronoField;\nimport java.time.temporal.TemporalAccessor;\n\npublic abstract class ZonedTimeDelegate<T> extends DateAndTimeFormatterDelegate<T, TemporalAccessor> {\n  private static final ZoneOffset MAX_ZONE_OFFSET = ZoneOffset.of(\"+14:00\");\n  private static final ZoneOffset MIN_ZONE_OFFSET = ZoneOffset.of(\"-12:00\");\n\n  public ZonedTimeDelegate() {\n    super(ZonedTimeDelegate::extractOffsetTime, ZonedTimeDelegate::extractWithLocalOffset);\n  }\n\n  private static TemporalAccessor extractOffsetTime(TemporalAccessor temporal) {\n    OffsetTime offsetTime = OffsetTime.from(temporal);\n    ZoneOffset offset = offsetTime.getOffset();\n    if (MAX_ZONE_OFFSET.compareTo(offset) > 0 || MIN_ZONE_OFFSET.compareTo(offset) < 0) {\n      throw new DateTimeException(DataGridBundle.message(\"zoned.time.out.of.range\"));\n    }\n    return offsetTime;\n  }\n\n  private static TemporalAccessor extractWithLocalOffset(TemporalAccessor temporal) {\n    if (temporal.isSupported(ChronoField.OFFSET_SECONDS)) {\n      throw new DateTimeException(DataGridBundle.message(\"zoned.time.out.of.range\"));\n    }\n    return LocalTime.from(temporal).atOffset(DataGridFormattersUtilCore.getDefaultOffset());\n  }\n}\n","sourceCodeStart":6,"sourceCodeEnd":36,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/grid/core-impl/src/run/ui/grid/editors/ZonedTimeDelegate.java#L6-L36","documentation":"ZonedTimeDelegate.extractOffsetTime throws DateTimeException('Offset out of range (from -12:00 to +14:00)') when an OffsetTime parsed from user input carries a zone offset outside the ISO-8601 real-world bounds MIN_ZONE_OFFSET (-12:00) to MAX_ZONE_OFFSET (+14:00). The grid's zoned-time editor enforces these bounds before accepting the value.","triggerScenarios":"Parsing/committing a time string with an offset like +15:30 or -13:00 in a database grid column of type TIME WITH TIME ZONE; OffsetTime.from(temporal) succeeds but the offset comparison fails.","commonSituations":"User typos in the offset portion of a time literal; data imported from a source with malformed offsets; locales/tools emitting non-standard offsets; testing with synthetic extreme values.","solutions":["Correct the offset in the input to within -12:00..+14:00","Validate the offset before commit: parse ZoneOffset and compare against the bounds","Show an inline editor hint about the accepted offset range when parsing fails"],"exampleFix":"// before\nOffsetTime t = OffsetTime.parse(\"15:30+15:00\");\n\n// after\nOffsetTime t = OffsetTime.parse(\"15:30+14:00\"); // keep offset within -12:00..+14:00","handlingStrategy":"validation","validationCode":"static final ZoneOffset MAX = ZoneOffset.of(\"+14:00\"), MIN = ZoneOffset.of(\"-12:00\");\nboolean offsetOk(TemporalAccessor t) {\n  ZoneOffset o = OffsetTime.from(t).getOffset();\n  return MAX.compareTo(o) >= 0 && MIN.compareTo(o) <= 0;\n}","typeGuard":null,"tryCatchPattern":"catch (DateTimeException e) if 'Offset out of range': keep the editor open and highlight the offset field","preventionTips":["Parse and validate the offset portion of time literals before commit","Constrain input masks/autocompletion for offsets to -12:00..+14:00","Reject imported data with out-of-range offsets at load time, not at edit time"],"tags":["grid","datetime","timezone","validation","intellij"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}