use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class DailyPeriodType method getPreviousPeriod.
@Override
public Period getPreviousPeriod(Period period, Calendar calendar) {
DateTimeUnit dateTimeUnit = createLocalDateUnitInstance(period.getStartDate(), calendar);
dateTimeUnit = calendar.minusDays(dateTimeUnit, 1);
Date date = calendar.toIso(dateTimeUnit).toJdkDate();
return new Period(this, date, date);
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class DailyPeriodType method getNextPeriod.
// -------------------------------------------------------------------------
// CalendarPeriodType functionality
// -------------------------------------------------------------------------
@Override
public Period getNextPeriod(Period period, Calendar calendar) {
DateTimeUnit dateTimeUnit = createLocalDateUnitInstance(period.getStartDate(), calendar);
dateTimeUnit = calendar.plusDays(dateTimeUnit, 1);
Date date = calendar.toIso(dateTimeUnit).toJdkDate();
return new Period(this, date, date);
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class FinancialPeriodType method getPreviousPeriod.
@Override
public Period getPreviousPeriod(Period period, Calendar calendar) {
DateTimeUnit dateTimeUnit = createLocalDateUnitInstance(period.getStartDate(), calendar);
dateTimeUnit = calendar.minusYears(dateTimeUnit, 1);
return createPeriod(dateTimeUnit, calendar);
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class FinancialPeriodType 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 MonthlyPeriodType method getPreviousPeriod.
@Override
public Period getPreviousPeriod(Period period, Calendar calendar) {
DateTimeUnit dateTimeUnit = calendar.fromIso(DateTimeUnit.fromJdkDate(period.getStartDate()));
dateTimeUnit = calendar.minusMonths(dateTimeUnit, 1);
return createPeriod(dateTimeUnit, calendar);
}
Aggregations