java.lang.Object
com.darkcollective.relix.ast.internal.TemporalLiterals

public final class TemporalLiterals extends Object
Parses the ISO-8601 payloads of the typed temporal literals (DATE '…', TIME '…', TIMESTAMP '…', DURATION '…') into the java.time values carried by DateOperand, TimeOperand, TimestampOperand, and DurationOperand.

This is the single source of truth for literal payload validation, so the parser (which reports a positioned error on a malformed payload) and the test fixtures share identical parsing — most importantly the TIMESTAMP UTC-normalisation rule: a payload carrying an offset (Z, +01:00) is normalised to a UTC Instant, and a payload without an offset is interpreted as UTC.

Every method throws DateTimeParseException (the unchecked java.time parse failure) when the payload is not a valid ISO-8601 string of the expected shape; callers translate it into their own diagnostic.

  • Method Details

    • parseDate

      public static LocalDate parseDate(String iso)
      Parses an ISO-8601 local-date payload, e.g. "2026-06-15".
    • parseTime

      public static LocalTime parseTime(String iso)
      Parses an ISO-8601 local-time payload, e.g. "13:40:00".
    • parseTimestamp

      public static Instant parseTimestamp(String iso)
      Parses an ISO-8601 timestamp payload into a UTC Instant. A payload carrying an offset ("2026-06-15T13:40:00Z", "…+01:00") is normalised to UTC; a payload without an offset ("2026-06-15T13:40:00") is interpreted as UTC.
    • parseDuration

      public static Duration parseDuration(String iso)
      Parses an ISO-8601 duration payload, e.g. "PT30M".