@SuppressWarnings("MethodMayBeStatic") // Non-static to support DI.
  public long parse(final String text) {

    final String date;
    final String time;
    final String timezone;

    if (text.contains("T")) {
      date = text.substring(0, text.indexOf('T'));
      final String withTimezone = text.substring(text.indexOf('T') + 1);
      timezone = getTimezone(withTimezone);
      time = completeTime(withTimezone.substring(0, withTimezone.length() - timezone.length())
              .replaceAll("Z$",""));
    } else {
      date = completeDate(text);
      time = completeTime("");
      timezone = "";
    }

    try {
      final ZoneId zoneId = parseTimezone(timezone);
      return PARSER.parse(date + "T" + time, zoneId);
    } catch (final RuntimeException e) {
      throw new KsqlException("Failed to parse timestamp '" + text
          + "': " + e.getMessage()
          + HELP_MESSAGE,
          e
      );
    }
  }
@Test
  public void shouldParseDateWithHour() {
    // When:
    assertThat(parser.parse("2020-12-02T13"), is(fullParse("2020-12-02T13:00:00.000+0000")));
    assertThat(parser.parse("2020-12-02T13Z"), is(fullParse("2020-12-02T13:00:00.000+0000")));
  }