protected Period toIsoPeriod(
      DateTimeUnit start, DateTimeUnit end, org.hisp.dhis.calendar.Calendar calendar) {
    DateTimeUnit from = calendar.toIso(start);
    DateTimeUnit to = calendar.toIso(end);

    return new Period(this, from.toJdkDate(), to.toJdkDate(), getIsoDate(start, calendar));
  }
  /**
   * @param dateInterval DateInterval to create period from
   * @return the period.
   */
  public Period createPeriod(DateInterval dateInterval) {
    if (dateInterval == null || dateInterval.getFrom() == null || dateInterval.getTo() == null) {
      return null;
    }

    org.hisp.dhis.calendar.Calendar cal = getCalendar();

    final DateTimeUnit from = cal.toIso(dateInterval.getFrom());
    final DateTimeUnit to = cal.toIso(dateInterval.getTo());

    return new Period(this, from.toJdkDate(), to.toJdkDate(), getIsoDate(from));
  }
  /**
   * Returns an instance of a Calendar without any time of day, with the current date.
   *
   * @return an instance of a Calendar without any time of day.
   */
  public static Calendar createCalendarInstance() {
    org.hisp.dhis.calendar.Calendar cal = getCalendar();

    return cal.toIso(cal.today()).toJdkCalendar();
  }