@Override
  public long periodUntil(DateTime endDateTime, PeriodUnit unit) {

    if (endDateTime instanceof OffsetDate == false) {
      throw new DateTimeException("Unable to calculate period between objects of two different types");
    }
    if (unit instanceof ChronoUnit) {
      OffsetDate end = (OffsetDate) endDateTime;
      long offsetDiff = end.offset.getTotalSeconds() - this.offset.getTotalSeconds();
      LocalDate endLocal = end.date.plusDays(Jdk8Methods.floorDiv(-offsetDiff, SECONDS_PER_DAY));
      return this.date.periodUntil(endLocal, unit);
    }
    return unit.between(this, endDateTime).getAmount();
  }