code: public static ZonedDateTime addOffset(ZonedDateTime time, String offset) {
      final Matcher matcher = OFFSET_PATTERN.matcher(offset);
  
      if (!matcher.matches()) {
        throw new DateTimeParseException("Unable to parse offset period", offset, 0);
      }
      final String sign = matcher.group(1);
  
      final String periodOffset = sign + "P" + Optional.ofNullable(matcher.group(2)).orElse("0D");
      final String durationOffset = sign + "PT" + Optional.ofNullable(matcher.group(4)).orElse("0S");
  
      final TemporalAmount dateAmount = Period.parse(periodOffset);
      final TemporalAmount timeAmount = Duration.parse(durationOffset);
  
      return time.plus(dateAmount).plus(timeAmount);
    }
docs: Applies an ISO 8601 Duration to a {@link ZonedDateTime}.
  
  <p>Since the JDK defined different types for the different parts of a Duration
  specification, this utility method is needed when a full Duration is to be applied to a
  {@link ZonedDateTime}. See {@link Period} and {@link Duration}.
  
  <p>All date-based parts of a Duration specification (Year, Month, Day or Week) are parsed
  using {@link Period#parse(CharSequence)} and added to the time. The remaining parts (Hour,
  Minute, Second) are parsed using {@link Duration#parse(CharSequence)} and added to the time.
  
  @param time   A zoned date time to apply the offset to
  @param offset The offset in ISO 8601 Duration format
  @return A zoned date time with the offset applied