use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class PersianCalendarTest method testMinusWeeks.
@Test
void testMinusWeeks() {
DateTimeUnit dateTimeUnit = new DateTimeUnit(1382, 1, 10);
DateTimeUnit testDateTimeUnit = calendar.minusWeeks(dateTimeUnit, 2);
assertEquals(1381, testDateTimeUnit.getYear());
assertEquals(12, testDateTimeUnit.getMonth());
assertEquals(25, testDateTimeUnit.getDay());
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class PersianCalendarTest method testMinusDays.
@Test
void testMinusDays() {
DateTimeUnit dateTimeUnit = new DateTimeUnit(1371, 1, 1);
DateTimeUnit testDateTimeUnit = calendar.minusDays(dateTimeUnit, 1);
assertEquals(1370, testDateTimeUnit.getYear());
assertEquals(12, testDateTimeUnit.getMonth());
assertEquals(30, testDateTimeUnit.getDay());
testDateTimeUnit = calendar.minusDays(dateTimeUnit, 366);
assertEquals(1370, testDateTimeUnit.getYear());
assertEquals(1, testDateTimeUnit.getMonth());
assertEquals(1, testDateTimeUnit.getDay());
dateTimeUnit = new DateTimeUnit(1371, 7, 1);
testDateTimeUnit = calendar.minusDays(dateTimeUnit, 1);
assertEquals(1371, testDateTimeUnit.getYear());
assertEquals(6, testDateTimeUnit.getMonth());
assertEquals(31, testDateTimeUnit.getDay());
dateTimeUnit = new DateTimeUnit(1371, 8, 1);
testDateTimeUnit = calendar.minusDays(dateTimeUnit, 1);
assertEquals(1371, testDateTimeUnit.getYear());
assertEquals(7, testDateTimeUnit.getMonth());
assertEquals(30, testDateTimeUnit.getDay());
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class PersianCalendarTest method testToInterval.
@Test
void testToInterval() {
DateTimeUnit start = new DateTimeUnit(1373, 6, 1, java.util.Calendar.FRIDAY);
DateInterval interval = calendar.toInterval(start, DateIntervalType.ISO8601_DAY, 0, 10);
assertEquals(1994, interval.getTo().getYear());
assertEquals(9, interval.getTo().getMonth());
assertEquals(2, interval.getTo().getDay());
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class NepaliCalendarTest method testFromIso.
@Test
void testFromIso() {
Assertions.assertEquals(new DateTimeUnit(2071, 1, 1, false), calendar.fromIso(new DateTimeUnit(2014, 4, 14, true)));
Assertions.assertEquals(new DateTimeUnit(2071, 1, 1, false), calendar.fromIso(2014, 4, 14));
}
use of org.hisp.dhis.calendar.DateTimeUnit in project dhis2-core by dhis2.
the class EthiopianCalendarTest method testMinusDays.
@Test
void testMinusDays() {
DateTimeUnit dateTimeUnit = new DateTimeUnit(2007, 1, 1);
DateTimeUnit testDateTimeUnit = calendar.minusDays(dateTimeUnit, 2);
assertEquals(2006, testDateTimeUnit.getYear());
assertEquals(12, testDateTimeUnit.getMonth());
assertEquals(29, testDateTimeUnit.getDay());
}
Aggregations