docs: static DateTime determineRotationPeriodAnchor(@Nullable DateTime lastAnchor, Period period) {
          final Period normalized = period.normalizedStandard();
          int years = normalized.getYears();
          int months = normalized.getMonths();
          int weeks = normalized.getWeeks();
          int days = normalized.getDays();
          int hours = normalized.getHours();
          int minutes = normalized.getMinutes();
          int seconds = normalized.getSeconds();
  
          if (years == 0 && months == 0 && weeks == 0 && days == 0 && hours == 0 && minutes == 0 && seconds == 0) {
              throw new IllegalArgumentException("Invalid rotation period specified");
          }
  
          // find the largest non-zero stride in the period. that's our anchor type. statement order matters here!
          DateTimeFieldType largestStrideType = null;
          if (seconds > 0) largestStrideType = secondOfMinute();
          if (minutes > 0) largestStrideType = minuteOfHour();
          if (hours > 0) largestStrideType = hourOfDay();
          if (days > 0) largestStrideType = dayOfMonth();
          if (weeks > 0) largestStrideType = weekOfWeekyear();
          if (months > 0) largestStrideType = monthOfYear();
          if (years > 0) largestStrideType = year();
          if (largestStrideType == null) {
              throw new IllegalArgumentException("Could not determine rotation stride length.");
          }
  
          final DateTime anchorTime = MoreObjects.firstNonNull(lastAnchor, Tools.nowUTC());
  
          final DateTimeField field = largestStrideType.getField(anchorTime.getChronology());
          // use normalized here to make sure we actually have the largestStride type available! see https://github.com/Graylog2/graylog2-server/issues/836
          int periodValue = normalized.get(largestStrideType.getDurationType());
          final long fieldValue = field.roundFloor(anchorTime.getMillis());
  
          final int fieldValueInUnit = field.get(fieldValue);
          if (periodValue == 0) {
              // https://github.com/Graylog2/graylog2-server/issues/836
              log.warn("Determining stride length failed because of a 0 period. Defaulting back to 1 period to avoid crashing, but this is a bug!");
              periodValue = 1;
          }
          final long difference = fieldValueInUnit % periodValue;
          final long newValue = field.add(fieldValue, -1 * difference);
          return new DateTime(newValue, DateTimeZone.UTC);
      }