use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class SixMonthlyAbstractPeriodType method getNextPeriod.
// -------------------------------------------------------------------------
// CalendarPeriodType functionality
// -------------------------------------------------------------------------
@Override
public Period getNextPeriod(Period period, Calendar calendar) {
DateTimeUnit dateTimeUnit = calendar.fromIso(DateTimeUnit.fromJdkDate(period.getStartDate()));
dateTimeUnit = calendar.plusMonths(dateTimeUnit, 6);
return createPeriod(calendar.toIso(dateTimeUnit), calendar);
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class SixMonthlyAbstractPeriodType method getPreviousPeriod.
@Override
public Period getPreviousPeriod(Period period, Calendar calendar) {
DateTimeUnit dateTimeUnit = calendar.fromIso(DateTimeUnit.fromJdkDate(period.getStartDate()));
dateTimeUnit = calendar.minusMonths(dateTimeUnit, 6);
return createPeriod(dateTimeUnit, calendar);
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class YearlyPeriodType method getNextPeriod.
// -------------------------------------------------------------------------
// CalendarPeriodType functionality
// -------------------------------------------------------------------------
@Override
public Period getNextPeriod(Period period, Calendar calendar) {
DateTimeUnit dateTimeUnit = createLocalDateUnitInstance(period.getStartDate(), calendar);
dateTimeUnit = calendar.plusYears(dateTimeUnit, 1);
return createPeriod(dateTimeUnit, calendar);
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class WeeklyAbstractPeriodType method getNextPeriod.
@Override
public Period getNextPeriod(Period period, Calendar calendar) {
DateTimeUnit dateTimeUnit = createLocalDateUnitInstance(period.getStartDate(), calendar);
dateTimeUnit = calendar.plusWeeks(dateTimeUnit, 1);
return createPeriod(dateTimeUnit, calendar);
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class QuarterlyPeriodType method getNextPeriod.
// -------------------------------------------------------------------------
// CalendarPeriodType functionality
// -------------------------------------------------------------------------
@Override
public Period getNextPeriod(Period period, org.hisp.dhis.calendar.Calendar calendar) {
DateTimeUnit dateTimeUnit = createLocalDateUnitInstance(period.getStartDate(), calendar);
dateTimeUnit = calendar.plusMonths(dateTimeUnit, 3);
return createPeriod(dateTimeUnit, calendar);
}
Aggregations